|
-
May 22nd, 2001, 07:27 AM
#1
timer Qustion
I need to make an timer which should start from 0:0:0 and gave me value in same format ( i dont need any counter )
-
May 22nd, 2001, 09:10 AM
#2
Re: timer Qustion
you may be interested in time differences
ie:
dim lngStart as double
dim lngEnd as double
dim lngResult as double
lngStart= Now
'do yourstuff
lngEnd=Now
lngResult = lngStart-lngEnd
'and maybe use format function on lngResult (or on lngStart AND lngEnd )to see lngResult as you like
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
May 22nd, 2001, 09:39 AM
#3
Re: timer Qustion
Timer that ticks every 1 second right? So after 5 1/2 mins, it should display 0:5:30? Anyway consider the following:
A project with 1 form (Form1) and 3 text editor controls (Text1, Text2, Text3), a timer (Timer1) and lastly a command button (Command1). Text1 represents SEC, Text2 represents MIN and Text3 represents HR. Set .Interval property to 1000 (so that it will trigger every 1 second) and the .Enabled property to FALSE.
private Sub Command1_Click()
If (Command1.Caption = "&Start Timer") then
Text1.Text = "0"
Text2.Text = "0"
Text3.Text = "0"
Timer1.Enabled = true
Command1.Caption = "&Stop Timer"
else
Timer1.Enabled = false
Command1.Caption = "&Start Timer"
End If
End Sub
private Sub Text1_Change()
If (CInt(Text1.Text) = 60) then
Text1.Text = "0"
Text2.Text = CInt(Text2.Text) + 1
End If
End Sub
private Sub Text2_Change()
If (CInt(Text2.Text) = 60) then
Text2.Text = "0"
Text3.Text = CInt(Text2.Text) + 1
End If
End Sub
private Sub Timer1_Timer()
Text1.Text = CInt(Text1.Text) + 1
End Sub
-Cool Bizs
Good Luck,
-Cool Bizs
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
|