Vb.net关机命令 [英] Vb.net Shutdown Command

查看:160
本文介绍了Vb.net关机命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,



当我在我的vb.net项目中使用以下代码时,它在60秒后工作并关闭计算机。



Sir,

When I used following code in my vb.net project then it worked and shuted-down computer after 60 sec.

Dim cmd
      Dim obj
      cmd = ("shutdown -s -t 60 -f")
      obj = CreateObject("WScript.Shell")
      obj.run(cmd)







但是我想用一个用户输入时间的文本框满足他的需要。所以我修改了代码并使用了以下代码,但它没有用。






But I want to use a textbox in which user will type time as his need. So I modified code and used following code but it did not work.

Dim cmd
       Dim obj
       cmd = ("shutdown -s -t" & val(textbox1.text) * 60 "-f")
       obj = CreateObject("WScript.Shell")
       obj.run(cmd)





请帮帮我。



问候,

Zubair



Please help me.

Regards,
Zubair

推荐答案

试试这个 -



i想想,你忘了添加空格 -



Try this-

i think, you forgot to add spaces-

Dim cmd
       Dim obj
       cmd = ("shutdown -s -t " & val(textbox1.text) * 60 " -f")
       obj = CreateObject("WScript.Shell")
       obj.run(cmd)


这篇关于Vb.net关机命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆