Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Sir,

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

VB
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.

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


Please help me.

Regards,
Zubair
Posted

1 solution

Try this-

i think, you forgot to add spaces-

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900