Display time

  • Thread starter Thread starter Will
  • Start date Start date
W

Will

Hi there ..

I wanna know how to display the time in a label and have
it change every sec with the system cock ...

meaning that its always syncronized with the system clock,
Sec per sec.

I need the code.

Thanks Guys!
 
Will said:
Hi there ..

I wanna know how to display the time in a label and have
it change every sec with the system cock ...

meaning that its always syncronized with the system clock,
Sec per sec.

I need the code.

Thanks Guys!

Drop a Timer from the toolbox to your Form. Set Interval property = 500. In
the timer's tick event, update the label. Date.Now returns the current date
and time. Call the ToString method of the returned date object. You can pass
the needed format to the function.
 
* "Will said:
I wanna know how to display the time in a label and have
it change every sec with the system cock ...

meaning that its always syncronized with the system clock,
Sec per sec.

Add a timer control ('System.Windows.Forms.Timer' to your form, set its
'Interval' property to 1000 and add this code to its 'Tick' event
handler:

\\\
Me.Label1.Text = DateTime.Now.ToShortTimeString()
///
 
* "Armin Zingler said:
Drop a Timer from the toolbox to your Form. Set Interval property = 500. In

Setting it to 500 is clever! I didn't think of that...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

hdparm -Tt ? 13
Coding question 3
TreeView performance 1
XP Slow Clock on intel i7? 2
Need help in debugging a stopwatch program 5
Hiya all 7
Cumulative time calculation in Excel 2003 2
Use of event handling 6

Back
Top