Link to home
Start Free TrialLog in
Avatar of sirbounty
sirbountyFlag for United States of America

asked on

Best way to implement a 'clock'

I've done this in vb6 - but wanted to know the best route to take in vb.net (2005).
I simply want a label with the current time HH:MM:SS to update every second.

If a timer is the best route, can someone assist me in writing the code for it - without placing the timer control on the form?
Avatar of Jens Fiederer
Jens Fiederer
Flag of United States of America image

Go ahead and PLACE the timer control "on the form" - it is not visible, so it won't cause you any problem - it is just a way to indicate to the designer that you are using it!
you don't need the timer as a component. Have a look to this article about using the .net Timer() class:
http://www.codeproject.com/csharp/cstimer01.asp

ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
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
*Note that in VB.Net you can use the WithEvents/Handles combination...    (C# doesn't have a direct equivalent)
Avatar of sirbounty

ASKER

Thanx IM - that's what I'd been trying to get working, but was missing something...
I think at one point it was complaining about tmr already existing in 'this' class, although I couldn't find any reference.
Will give this another shot - thanx!