I haven't tried this, but I would imagine you can add a textbox
then add a timer and on the timer's event, you set the textbox's value to now() formatted however you want it..
I haven't tried this, but I would imagine you can add a textbox
then add a timer and on the timer's event, you set the textbox's value to now() formatted however you want it..
I have done this. A couple of things to watch out for:
1. Windows Timer event is not "exact". That is, you'll need to set the timer interval pretty low in order to get something that "seems" to update every second.
2. Just updating a text field "may" give you a choppy looking clock. I recall using 2 text boxes, and updating them on alternate cycles, and changing their .visible properties.
3. If your program gets busy doing other stuff (a long loop that ties the CPU up), your clock may behave funny. You'll need to put a "DoEvents" in any long loops to eliminate this.
Remember, it was a long time ago when I did this. A lot has changed (cpu speeds, OSs) since then.
Keeping in mind Allan's warning about using system resources, here's a thing I use. You'll need a textbox called txtOmega (yeah, I'm a watch fanatic) and you'll maybe want to add some cosmetics to it, like a frame around it. If you'd also like to show the date, add a textbox called txtDayRunner. If you don't want the date, don't use the line
Me.txtDayRunner = Date 'Display date
Goto your form's property box. Under the Event Tab find Timer Interval and enter 1000.
Code:
Private Sub Form_Open(Cancel As Integer)
'Displays while waiting for timer to crank up
Me.txtOmega = Time
End Sub
Private Sub Form_Timer()
Me.txtOmega = Time 'Display time
Me.txtDayRunner = Date 'Display date
End Sub
Is this attachment I found "Not Mine" what you are looking for? Or you could use a .swf file thats a clock. In your "More Controls menu" Find Shockwave Flash Object and set the box on your form and name it ShockwaveFlash1 then in your forms OnOpen event add the code below. If its a huge clock file then it slows down your app a little.... Hope this helps!
Code:
Private Sub Form_Open(Cancel As Integer)
Me.ShockwaveFlash1.Movie = Application.CurrentProject.Path & "\NameOfYourFile.swf"
End Sub