Click here to Skip to main content
12,699,351 members (33,398 online)
Click here to Skip to main content
Add your own
alternative version


23 bookmarked

ShutDown Timer

, 13 Aug 2006 CPOL
Rate this:
Please Sign up or sign in to vote.
Set timer to Turn Off your PC



Before going in detail about the application.

This simple programme help you if you want to set timer to turn off your PC after spacified period.

Core behined Code

The most important code in this programme

System.Diagnostics.Process.Start("Shutdown", "/s")

I pass ' Shutdown ' to turn off .

So how am I achieving it? (What is the code behind it?)

first I used timer of course to increese variables every Tick of timer :-

This snap shot of code

this global var
Dim x,min,cou,hh As Integer = 0

Private Sub Timer1_Tick

'For each tick

'here I make counter

'x second

x = x + 1

If x = 60 Then

x = 0

min = min + 1

ProgressBar1.Value = ProgressBar1.Value + 1

End If

If min = 60 Then

hh += 1

min = 0

End If

Label5.Text = hh

'to display the timer

Label4.Text = x

Label3.Text = min

'NumericUpDown1 Input of hour

'NumericUpDown1 Input of hour
'NumericUpDown1 Input of hour

Dim tothor As Integer = Int32.Parse(NumericUpDown1.Value)

Dim totmin As Integer = Int32.Parse(NumericUpDown2.Value)

tothor = tothor * 60

Dim total As Double = tothor + totmin

'every tick check if it we achieve total of Minute

Dim totallabel As Double = hh * 60 + min

If totallabel = total Then

cou += 1


End If

End Sub

Now You can shut down

This sub shutdown pc

Public Sub wa()

If cou = 1 Then


System.Diagnostics.Process.Start("Shutdown", "/s")

cou += 1

End If

End Sub


pop up window will show give 30 second before shutting down.


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


About the Author

Amr M. K.
Web Developer
Jordan Jordan
- Need is the mother of the invitation .
- To be acknowledge is matter of time..
be skillfull..needs...

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
Muhammady18-Mar-12 11:49
memberMuhammady18-Mar-12 11:49 
GeneralMy vote of 5 Pin
versx1-Aug-10 22:37
memberversx1-Aug-10 22:37 
Joke:( Pin
The_Mega_ZZTer13-Aug-06 10:02
memberThe_Mega_ZZTer13-Aug-06 10:02 
GeneralRe: :(hi [modified] Pin
mr.stick14-Aug-06 0:23
membermr.stick14-Aug-06 0:23 
Generalhe meant logoff Pin
Fabse_net14-Aug-06 5:02
memberFabse_net14-Aug-06 5:02 
GeneralRe: he meant logoff Pin
mr.stick14-Aug-06 9:10
membermr.stick14-Aug-06 9:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170118.1 | Last Updated 13 Aug 2006
Article Copyright 2006 by Amr M. K.
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid