StatusBar and Displaying the time

  • Thread starter Thread starter Brad Sanders
  • Start date Start date
B

Brad Sanders

Hello All,

I am working on an application and would like to display
the current time in the statusbar on the main form. Is
there an easy way to keep the current time displayed? I
know that I can always set the statusbar section text to
time.now but it seams like I would have to place this
where it would get called all of the time. Any thoughts.

Thanks
Brad
 
Hi Brad,

You can Drag a Timer Control off the ToolBox onto your Form, or you
can create a System.Timers.Timer in your Form_Load. In either case, the
Timer would be set to go off every second and you'd update the StatusBar
in the Timer's event handler.

Regards,
Fergus
 
* "Brad Sanders said:
I am working on an application and would like to display
the current time in the statusbar on the main form. Is
there an easy way to keep the current time displayed? I
know that I can always set the statusbar section text to
time.now but it seams like I would have to place this
where it would get called all of the time. Any thoughts.

Add a Timer control from the toolbox to the form
('System.Windows.Forms.Timer'), set its 'Interval' property to '1000'
and the 'Enabled' property to 'True'. Then add code like this to its
'Tick' event handler:

\\\
sbStatusBar.Text = Today.Date.ToString("dd.MM.yyyy") & ", " & TimeOfDay.ToString("hh:mm:ss")
///
 
Back
Top