ShutDown Timer
Set timer to Turn Off your PC
Introduction
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 varDim 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 wa() End If End Sub
Now You can shut down
This sub shutdown pc
Public Sub wa()
If cou = 1 Then
Me.Show()
System.Diagnostics.Process.Start("Shutdown", "/s")
cou += 1
End If
End Sub
Finaly
pop up window will show give 30 second before shutting down.