How to log off system using vb.net

Posted by Vforvijay under VB.NET on 3/1/2011 | Points: 10 | Views : 16440 | Status : [Member] | Replies : 4
hi..Anyone plz helpme i was wondering the code for log off windoes using vb.net,my requirement is i want to set the time through forms ,when the time reaches system will logoff from the windows...




Responses

Posted by: Naimishforu on: 3/1/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Write this code wherever you want :

http://www.dotnetfunda.com/codes/code1428-log-off-your-computer-.aspx

Thanks,
Naimish
http://dotnetinterview.zxq.net/
http://naimishpandya.blogspot.in/

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 3/1/2011 [Member] Starter | Points: 25

Up
0
Down
But its not working ...

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naimishforu on: 3/1/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Try this,

System.Diagnostics.Process.Start("C:\WINDOWS\system32\shutdown.exe", "-s -t 00")


Thanks,
Naimish
http://dotnetinterview.zxq.net/
http://naimishpandya.blogspot.in/

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jagadish97 on: 3/2/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Vijay

Try this

System.Diagnostics.Process.Start("shutdown", "-s -t 00")


System.Diagnostics.Process.Start("shutdown", "-l -t 00")

System.Diagnostics.Process.Start("shutdown", "-r -t 00")



if shutdown: we write after the comma "-s"
and to make it restart we write after the comma "-r"
and to make it logoff we write after the comma "-l"


Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response