This is really confusing me.
All im trying to do is create a digital clock on a windows form, so i googled and tried this code but it refuses to show in the label.
private void timer1_Tick(object sender, EventArgs e)
{
label1.Text = DateTime.Now.ToString("HH:mm:ss");
}
What am i doing wrong?
Thanks for all the help in advance
You need to set
timer1.Intervalto a reasonable value, like 1000.You also need to set
timer1.Enabled = true;Finally you need to make sure your event handler
timer1_Tickis connected to thetimer1.Tickevent of an existing timer.