Add a System.Windows.Forms.Timer to your form, in design view, called Timer1. Add a Label to your form called Label1. Set the Timer Interval to 1000 (milliseconds) and Enabled to True. Double-click the Timer to create a handler for the default event, which is Tick. In the event handler put this line of code:
Visual Basic:
Me.Label1.Text = Date.Now.ToLongTimeString()
The Date type also supports ToShortTimeString and ToString with format information.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.