This is a example how to create a simple digital clock in C# win form. The example use Timer in C# class and use the Tick event to update the label in the win form.
The Code Behind
public Form1()
{
InitializeComponent();
Timer T = new Timer();
T.Tick += new EventHandler(T_Tick);
T.Start();
}
void T_Tick(object sender, EventArgs e)
{
DateTime clock = DateTime.Now;
label1.Text = clock.Hour.ToString("00");
label2.Text = clock.Minute.ToString("00");
label3.Text = clock.Second.ToString("00");
}
By Mohd Zulkamal
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

0 comments:
Post a Comment