Link to home
Start Free TrialLog in
Avatar of RunBoris
RunBoris

asked on

Constantly Changing Label Captions

I have a lable that will tell the current time ("The current time is: 12:00:54 PM"), but it needs to change every second. Right now I am defining the caption at Form_Load, but I don't know where to define the caption so that the form automatically re-captions the label every second. Help?
ASKER CERTIFIED SOLUTION
Avatar of Zyloch
Zyloch
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ah, oops, forgot about that. Sorry!
Just in case you are not sure how to "Make a timer and put it on your form", the Timer control is in the Toolbox along with other standard controls such as the Label, TextBox and CommandButton.  It looks like a classic analog stopwatch and if you hover your mouse over it, a tooltip that says "Timer" will appear.  Just drag one onto your form (the size doesn't matter) and then double click on it.  This will produce the default Timer event that is executed every XXX milliseconds when the Enabled property of your timer control is set to True:

    Private Sub Timer1_Timer()
       
    End Sub

~IM
>>if you set it to 1000


set to 500 instead of 1000
Hi EDDYKT,

You didn't read my comments very carefully.  =)

I actually recommended using 333.    The "if you set it to 1000" you quoted, was just an example I used to explain how the interval property works.

~IM
Avatar of RunBoris
RunBoris

ASKER

That did work, but I have a nit-picky question. Points will still be awarded based on the previous responses (Most Zyloch, partially Idle_Mind for the interval intervention).

Is there any other way of doing this? I ask because if the program isn't started exactly on a second, you can see a noticable difference in the system time, and my program's time. Obviously it's only off by a few milliseconds, but those sort of thing get to me in a weird OCD way. (OCD, obsessive compulsive disorder.... I'm a perfectionist... Sorry...)
Hmmm.... I just did some experimenting with the timer intervals. I set it all the way down to 1, and the system clock was still not in sync with my program. So, I think any other means of updating my silly label would be in vain. Points are now awarded!