if you need more help, just tell me.
Code:
Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Declares a variable for our countdown timer.
Dim Count As CountDown
'Set the time to 3 minutes, this can be done in two ways
'----way 1----
Count = New CountDown(0, 3)
'--------
'----way 2----
Count = New CountDown
Count.SetTime(0, 3)
'--------
'If we want to add some more time we can do so, here I add 35 seconds.
Count.AddTime(35)
'add a handler to the tick event
AddHandler Count.Tick, AddressOf Count_Tick
'add a handler to the times up event
AddHandler Count.TimesOut, AddressOf Times_up
'starts the timer
Count.Start()
'It's also possible to pause and reset the timer.
' Count.Pause()
' Count.Reset()
End Sub
Private Sub Count_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
'since we added the handler, this code will occur once each second
'get the time left
Me.Text = sender.Days & " days, " & sender.Hours & " hours, " & sender.Minutes & " minutes and " & sender.Seconds & " seconds left."
'it's alo possible to use Totalseconds, totalminutes etc.
'This will return the total amount of them.
'For example if we got the time 1 minute and 30 seconds
'TotalSeconds will return 90 and Totalminutes will return 1.5.
End Sub
Private Sub Times_up(ByVal sender As System.Object, ByVal e As System.EventArgs)
'when the time us up this will happen
MessageBox.Show("Wake up!!!")
End Sub
Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum