Hi
I have a form that holds min two timers,
One is a 72 hour timer and one is a 12 hour timer.
What I am trying to do is have both run at the same time, when the 12 hour timer expires it'll bring up a form informing the user that in 60 hours the machine will reboot (or they can just hit reboot).
When the 72 hour timer expires it reboots the machine.
BUT I know my managment is going to want to be flexable. e.g instead of 72 hours make is 54, and instead of 12 make it 6.
I wish to avoid using global variables
This is the code for the 12 hour one, How do I call it and set i12sec and i12min?
************************************************
Private Sub t12hTimer_Tick(sender As System.Object, e As System.EventArgs, i12sec As Integer, i12min As Integer) Handles t12hTimer.Tick
t12hTimer.Interval = 1000 '1000 Miliseconds = 1 second
If t12hTimer.Enabled = True Then
i12sec = i12sec - 1
If i12sec = -1 Then i12min = i12min - 1
If i12sec = -1 Then i12sec = 59
If i12min = 0 And i12sec = 0 Then
t12hTimer.Enabled = False
MsgBox("Times up", MsgBoxStyle.OkOnly, "12 Hour Timer Time's Up")
End If
End If
Me.l12mLabel.Text = i12min
Me.l12SLabel.Text = i12sec
End Sub
I have a form that holds min two timers,
One is a 72 hour timer and one is a 12 hour timer.
What I am trying to do is have both run at the same time, when the 12 hour timer expires it'll bring up a form informing the user that in 60 hours the machine will reboot (or they can just hit reboot).
When the 72 hour timer expires it reboots the machine.
BUT I know my managment is going to want to be flexable. e.g instead of 72 hours make is 54, and instead of 12 make it 6.
I wish to avoid using global variables
This is the code for the 12 hour one, How do I call it and set i12sec and i12min?
************************************************
Private Sub t12hTimer_Tick(sender As System.Object, e As System.EventArgs, i12sec As Integer, i12min As Integer) Handles t12hTimer.Tick
t12hTimer.Interval = 1000 '1000 Miliseconds = 1 second
If t12hTimer.Enabled = True Then
i12sec = i12sec - 1
If i12sec = -1 Then i12min = i12min - 1
If i12sec = -1 Then i12sec = 59
If i12min = 0 And i12sec = 0 Then
t12hTimer.Enabled = False
MsgBox("Times up", MsgBoxStyle.OkOnly, "12 Hour Timer Time's Up")
End If
End If
Me.l12mLabel.Text = i12min
Me.l12SLabel.Text = i12sec
End Sub