Clock

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What is the easiest (or most effective) way to have the displayed time on a
form update automatically every second?

I have limited knowledge of visual basic so be gentle!!

tia
 
Private Sub Form_Load()
Me.TimerInterval = 1000
End Sub

Private Sub Form_Timer()
Me.Label0.Caption = Format$(Now(), "hh:mm:ss")
End Sub

You can set the form's TimerInterval property in the Properties window in
design view, you don't have to set it programatically as in my example. I
just did it that way so that you could see everything in the code. It's in
milliseconds, so 1000 is one second.
 
Spot on Brendan!
Thank for that.

Have you got nothing better to do at 5 in the morning than to help us poor
unfortunates?
 
Brendan's post shows as being at 8:00 for me, so you must be on the Left
Coast.

05:00 your time would be have been 13:00 for him, so the question isn't why
Brendan was posting at that time, but why the heck were you? <g>
 
Now, Doug, your post shows for me as being 5 in the morning (5:03 actually!)
.... and on Friday too.

So not only are you an insomniac but you're ahead of yourself ;-)
 
What's your point? <g>

The header says Thu, 2 Mar 2006 11:03:59 -0500, which if memory serves
sounds correct to me.
 
Doug said...
What's your point? <g>

<g> Only that we're all in different parts of the world and time ain't
necessarily what it seems.

What appeared as 5 am for Jock was actually 1 pm for Brendan, and your 11 am
was 5 am for me ;-)
 
Back
Top