How to make Shutdown Utilities

In this tutorial we are creating a shutdown utility program using the Visual Basic .NET, the tutorial is basically more calling the Shell to execute the shutdown, restart and log off features of your operating system. So, let’s start.

Things we need:
Microsoft Visual Basic .NET 2013 or later (I’m using Visual Basic 2010)

Step 1:
Create a New Project, name it ShutdownUtilities (see Image below)



Step 2:
Next, Add a New Form by navigating in Project Menu and Click Add Windows Form…


Step 3: 
Add 3 GroupBox, then Select the 1st GroupBox and change the Text Property to Shutdown, then if you want to change the Forecolor, just go to Forecolor Property change it to Highlight, do this in other 2 GroupBox with a Text Property of Restart and Log Off. (Please refer the image below).


Step 4:
Add 3 Buttons, then follow the settings below:

1st Button Property
Name: btnShutdown
Text: SHUTDOWN

2nd Button Property
Name: btnRestart
Text: RESTART

3rd Button Property
Name: btnLogOff
Text: LOG OFF

The Final Output




Copy and Paste the Code in your Code Editor

Public Class Form1

    Private Sub btnShutdown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShutdown.Click
        Shell("shutdown -s")
    End Sub

    Private Sub btnRestart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRestart.Click
        Shell("shutdown -r")
    End Sub

    Private Sub btnLogOff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogOff.Click
        Shell("shutdown -l")
    End Sub
End Class
That's it, you now have shutdown utility, Enjoy..Happy Coding!
How to make Shutdown Utilities How to make Shutdown Utilities Reviewed by code-dev on 10:19 PM Rating: 5

No comments:

Powered by Blogger.