ahmedr
Task Automation Guru
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
100 XP
We always used our computer system program to shutdwon, log-off, and restart our pc. But here in vb.net we can also do that.
Now, let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add three buttons named Button1 labeled as "Shutdown", Button2 labeled as "Logoff", and Button3 labeled as "Restart". You must design your layout like this:
3. Now put this code for your code module.
Legends/Explanation:
s stands for shutdown
r stands for restart
l stands for log off
t stands for countdown time
a stands for abort/cancel
c stands for message box and word is seperate by comma
The shell method here represents the objects in the Shell. Methods are provided to control the Shell and to execute commands within the Shell.
When you click Button1 it will shutdown your pc after 10 seconds.
When you click Button2 it will logoff your pc after 10 seconds.
When you click Button3 it will restart your pc after 10 seconds.
Download the source code below and try it! :)
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware
Download
Now, let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add three buttons named Button1 labeled as "Shutdown", Button2 labeled as "Logoff", and Button3 labeled as "Restart". You must design your layout like this:

3. Now put this code for your code module.
- Public
Class
Form1
- Private
Sub
Button1_Click(
ByVal
sender As
System.
Object
, ByVal
e As
System.
EventArgs
)
Handles
Button1.
Click
- Shell(
"shutdown -s -t 10 -c computer,will,shutdown,after,10,seconds"
)
- End
Sub
- Private
Sub
Button2_Click(
ByVal
sender As
System.
Object
, ByVal
e As
System.
EventArgs
)
Handles
Button2.
Click
- Shell(
"shutdown -l -t 10 -c computer,will,log-off,after,10,seconds"
)
- End
Sub
- Private
Sub
Button3_Click(
ByVal
sender As
System.
Object
, ByVal
e As
System.
EventArgs
)
Handles
Button3.
Click
- Shell(
"shutdown -r -t 10 -c computer,will,restart,after,10,seconds"
)
- End
Sub
- End
Class
Legends/Explanation:
s stands for shutdown
r stands for restart
l stands for log off
t stands for countdown time
a stands for abort/cancel
c stands for message box and word is seperate by comma
The shell method here represents the objects in the Shell. Methods are provided to control the Shell and to execute commands within the Shell.
When you click Button1 it will shutdown your pc after 10 seconds.
When you click Button2 it will logoff your pc after 10 seconds.
When you click Button3 it will restart your pc after 10 seconds.
Download the source code below and try it! :)
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware
Download
You must upgrade your account or reply in the thread to view hidden text.