display time in my program

  • Thread starter Thread starter avida
  • Start date Start date
A

avida

Hello all,

I'm trying to find the best way to display the clock all the time in
my form.(WM 5.0)a
should I use snapi function or maybe DateTime Class? I'm not realy
sure

Thanks very much in advance
 
Create a Timer (timerUpdateTime) and set the Interval to 1000. Create a
Label (m_DateTime) and place it on your form. In the Tick event for the
timer, add the following code:

private void timerUpdateTime_Tick(object sender, System.EventArgs e)
{
m_DateTime.Text = DateTime.Now.ToString("G");
}

You can set the format to whatever you want.
 
Back
Top