Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System Time on a Form

Status
Not open for further replies.

Channah

IS-IT--Management
Jan 16, 2003
38
US
I would like to have a textbox or label on a form that I am working with that will always display the system time. I am wanting this to be updated using the timer event in the form properties and I will have the interval for the timer set to 60000 milliseconds so that the update will occur each minute, Anyone have any ideas on the coding for someting like that?
 
You practically got it,

now all you have to do is
1) add a label to the form
2) in the timer event, put in

Private Sub Form_Timer()
Me.CurrentTime.Caption = Format(Now, "HH:NN:SS")
End Sub


where CurrentTime is the name of your label
 
I have set a label on the form with the Caption Set current time. I have then used the following code and still it returns the error below... whats up?

Compile Error: Method or data member not found

Private Sub Form_Timer()
Me.CurrentTime.Caption = Format(Now, "HH:MM:SS")
End Sub
 
Use NN (which means minutes) rather than MM (which means months)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top