How do you make a timed shutdown?

Posts 1–9 of 9 · Page 1 of 1
How do you make a timed shutdown?
I want to find out how to make a timed shutdown based on time and day. Not just at a certain time like 8pm because I want it to make the computer shut down in 2 or more days. I tried doing the label matching the time and day for each one, but it doesnt work for some reason . Please help, thank you.
Make your program check the date..If is the date what you want then shutdown..
And put it on startup folder .. done..

Like:

Dim ShutDate As Date = #06/05/2011 9:10PM#

Then in a timer:

If ShutDate = Date.Now Then

Shell("shutdown -s -t 0", vbHide)
End If

Quote Originally Posted by Lyoto Machida View Post
Make your program check the date..If is the date what you want then shutdown..
And put it on startup folder .. done..

Like:

Dim ShutDate As Date = #06/05/2011 9:10PM#

Then in a timer:

If ShutDate = Date.Now Then

Shell("shutdown -s -t 0", vbHide)
End If

So that's only for date right? I'm trying to look for date + time.
Quote Originally Posted by PixyStyx View Post
So that's only for date right? I'm trying to look for date + time.
What did you think 9:10PM meant? A date?

Date.Now is the date + time by the way, experimenting would show you that.
Quote Originally Posted by Lyoto Machida View Post
Make your program check the date..If is the date what you want then shutdown..
And put it on startup folder .. done..

Like:

Dim ShutDate As Date = #06/05/2011 9:10PM#

Then in a timer:

If ShutDate = Date.Now Then

Shell("shutdown -s -t 0", vbHide)
End If

In "#06/05/2011 9:10PM#", is it suppose to have "#"?
Quote Originally Posted by PixyStyx View Post
In "#06/05/2011 9:10PM#", is it suppose to have "#"?
Yes, but don't wrap quotation marks around it. You can use a string too if you want:

Dim ShutDate As Date = Date.Parse("06/05/2011 9:10PM")

Same results.
'My first timer!
'Maby u can use some?

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Start()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
TextBox1.Text = 0
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
TextBox1.Text += 1
If TextBox1.Text = ComboBox1.Text Then
Shell("shutdown -s")
Timer1.Stop()
End If
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
MsgBox("10/s!" & vbCrLf & "100/s!" & vbCrLf & "1800/s = 1/5H!" & vbCrLf & "3600/s = 1H!" & vbCrLf & "5400/s = 1.1/5H!" & vbCrLf & "7200/s = 2H!", MsgBoxStyle.Information, "Made by miz™")
End Sub
End Class


3: buttons
1: timer
1: comx
1: textbox
Quote Originally Posted by hackmiz View Post
Here is my verry first Shutdown timer i made
Fell free to use or modify! Dont forgot to leav Credits if u post som where else!

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Start()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
TextBox1.Text = 0
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
TextBox1.Text += 1
If TextBox1.Text = ComboBox1.Text Then
Shell("shutdown -s")
Timer1.Stop()
End If
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
MsgBox("10/s!" & vbCrLf & "100/s!" & vbCrLf & "1800/s = 1/5H!" & vbCrLf & "3600/s = 1H!" & vbCrLf & "5400/s = 1.1/5H!" & vbCrLf & "7200/s = 2H!", MsgBoxStyle.Information, "Made by miz™")
End Sub
End Class

3: buttons
1: timer
1: comx
1: textbox
It should work, but not how you want it too.

And 1/5 isn't half, 1/2 is half.
YH it was along time since i made this, so maby some errors, n i
saw after that this wasnt what he was looking for
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Need help?