|
-
Feb 14th, 2003, 03:14 PM
#1
Thread Starter
Addicted Member
Time
Ok I dont know if you use a timer or what not but in a label I want the time to count up. When Command button 1 is clicked it will start the time until it is stopped. So starting at 0 hours, 0 minutes, 0 seconds I want it to go up until it is stopped... So how would I do something like this? Well please reply with some feedback as its very much appreciated and happ v-day everyone
Thanks For The Help Guys 
-
Feb 14th, 2003, 03:19 PM
#2
Lively Member
You can use a timer control......
Add one to your form, then set it's interval to 1000, and enabled to false
VB Code:
Private Sub Command1_Click()
If Timer1.Enabled = True Then
Timer1.Enabled = False
Exit Sub
End If
Label1.Caption = "00:00:00"
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Label1.Caption = DateAdd("s", 1, Label1.Caption)
Label1.Caption = Format(Label1.Caption, "hh:mm:ss")
Label1.Refresh
End Sub
Last edited by bbressler; Feb 14th, 2003 at 03:22 PM.
-
Feb 14th, 2003, 03:24 PM
#3
Thread Starter
Addicted Member
Originally posted by bbressler
You can use a timer control......
Add one to your form, then set it's interval to 1000, and enabled to false
VB Code:
Private Sub Command1_Click()
If Timer1.Enabled = True Then
Timer1.Enabled = False
Exit Sub
End If
Label1.Caption = "00:00:00"
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Label1.Caption = DateAdd("s", 1, Label1.Caption)
Label1.Caption = Format(Label1.Caption, "hh:mm:ss")
Label1.Refresh
End Sub
Lol wow damn fast and very well explained bro thanks very much I appreciate it a lot happ v-day
Thanks For The Help Guys 
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
|