|
-
Sep 1st, 2011, 06:16 PM
#1
Thread Starter
Member
[RESOLVED] Countdown Timer
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
-
Sep 1st, 2011, 06:41 PM
#2
Re: Countdown Timer
 Originally Posted by homer5677
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
Yes, it is. Do you need to see code?
-
Sep 1st, 2011, 07:05 PM
#3
Re: Countdown Timer
Looks like you do. Build a form with a timer control and a label. Then apply this code:
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
WDYT?
-
Sep 1st, 2011, 07:44 PM
#4
Thread Starter
Member
Re: Countdown Timer
Thanks doc. I wasn't sure if VB was able to or if i needed something more powerful
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|