CoachBarker
Well-known member
- Joined
- Jul 26, 2007
- Messages
- 133
- Programming Experience
- 1-3
I have a timer on a form and I want it to count down from 90 seconds and when it hits 0 display a message box. I can get it to run but not from 90 seconds, it starts at 30.
I have declared a global variable
And in a sub
How can I get it to start at 90 Seconds?
Thanks
CoachBarker
I have declared a global variable
VB.NET:
Private gameTimeSpan As TimeSpan = TimeSpan.FromSeconds(90)
And in a sub
VB.NET:
Private Sub tmrPlay_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrPlay.Tick
Me.gameTimeSpan -= TimeSpan.FromMilliseconds(Me.tmrPlay.Interval)
'displays the time in a label
Dim display As String = Me.gameTimeSpan.Seconds.ToString()
If Me.gameTimeSpan.Seconds = -1 Then
tmrPlay.Stop()
MessageBox.Show("Time has run out")
End If
Me.lblPlayTimeCounter.Text = display
End Sub
How can I get it to start at 90 Seconds?
Thanks
CoachBarker