'I know the clock will count in seconds but if you have an
'Interval of 1000 then you will get a delay before it starts running
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Format(Time, "hh:mm:ss AM/PM")
End Sub
The analogue clock needs a lot more code. There are loads of examples on PSC
Last edited by Keithuk; Jan 30th, 2007 at 07:23 AM.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
'I know the clock will count in seconds but if you have an
'Interval of 1000 then you will get a delay before it starts running
Timer1.Interval = 1
So you will update the clock 64 times each second, just so you won't have to wait for the clock to display? Seems like a waste. Just call the timer routine to get the clock running.
Just call the timer routine to get the clock running.
VB Code:
Timer1.Interval = 1000
Timer1.Enabled = True
Call Timer1_Timer
The Timer can be running before the Form loads and you still have a delay with a 1 second interval.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
The timer cannot be running before the form is loaded. That would be like a program running before the computer is turned on. I think what you meant is that the timer can be enabled at design-time. In any case, the initial delay can be avoided by calling the timer's timer event, as in my example.
Hey hey guys... apparently misher2000 hasn't replied yet... so why are we arguing over what he wants... wait till he replies... calm down....
btw... Welcome to the forums misher2000
Khanjan
Hey... If you found this post helpful please rate it.
dannyg... if you look at the example in post 7, thats exactly what it does
And post #3.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.