Hi
Is it possible or in VB to make a countdown timer that the user could see that would display time counting down for eg. 5 sec to 0 sec.
Thanks
Printable View
Hi
Is it possible or in VB to make a countdown timer that the user could see that would display time counting down for eg. 5 sec to 0 sec.
Thanks
Looks like you do. Build a form with a timer control and a label. Then apply this code:
WDYT?Code:Dim TimeSec As Integer
Private Sub Form_Load()
Timer1.Interval = 1000
Label1.Caption = 10 ' Set this to the starting time in seconds.
End Sub
Private Sub Timer1_Timer()
TimeSec = CInt(Label1.Caption)
If TimeSec < 1 Then MsgBox "Time is up." Else Label1.Caption = Trim(TimeSec - 1)
End Sub
Thanks doc. I wasn't sure if VB was able to or if i needed something more powerful