time

paperback
12-08-2004, 12:34 AM
i am attempting to put a current time on my program, but it is set to where you must click on it...

what component should i use for real-time

here is my code

Me.lblTime.Caption = "" & _
Format(Now, "hh:mm:ss am/pm")

Gruff
12-08-2004, 12:52 AM
Put your code inside the timer event of a timer control. Set its interval to 1000. (1 sec)

~T

paperback
12-08-2004, 01:13 AM
ok i did that

now i have it as


Me.Timer1.Caption = "" & _
Format(Now, "hh:mm:ss am/pm")


but the 'Caption' is a problem??

Verphix
12-08-2004, 02:03 AM
You don't do it as so.
You have to insert the timer on your form, set it's interval property to 1000, double click it, and then insert your code :

Me.lblTime.Caption = "" & _
Format(Now, "hh:mm:ss am/pm")

So if your timer is timer1, it goes like this (you don't need the qoutes):
Private Sub Timer1_Timer()
Me.lblTime.Caption = Format(Now, "hh:mm:ss am/pm")
End Sub

;)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum