please can you tell me how to put a normal clock on vb6 on my form page ???
Printable View
please can you tell me how to put a normal clock on vb6 on my form page ???
Moved from FAQ forum
Digital or analogue clock?
Digital
The analogue clock needs a lot more code. There are loads of examples on PSC ;)VB Code:
Private Form_Load() '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
Here's for analog clock:
http://www.vbforums.com/showpost.php...9&postcount=13
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.Quote:
Originally Posted by Keithuk
VB Code:
Timer1.Interval = 1000 Timer1.Enabled = True Call Timer1_Timer
You can trigger the _Timer event no mather that:Quote:
Originally Posted by Keithuk
edit: totally missed Logophobic's post :blush:VB Code:
Private Sub Form_Load() Timer1.Interval = 1000 [B] Timer1_Timer[/B] End Sub Private Sub Timer1_Timer() Label1.Caption = Format(Time, "hh:mm:ss AM/PM") End Sub
Here's a two line example...
Khanjan
The Timer can be running before the Form loads and you still have a delay with a 1 second interval.Quote:
Originally Posted by Logophobic
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
put timer on the form and set the delay to 1000 then add a label to the form and...
Private Sub Timer1_Timer()
label1.Caption = Format(Now, "hh:mm:ss")
End Sub
dannyg... if you look at the example in post 7, thats exactly what it does
sorry dint download it to see am at college lol
And post #3. :rolleyes:Quote:
Originally Posted by khanjan_a2k