Step 1: Click New Project, then select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project "DigitalClock" and then click OK
Step 2: Design your form as below

You need to add a timer control to your form
Step 3: Add code to handle your form as below
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DigitalClock
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
lblStatus.Text = DateTime.Now.ToString("T");
}
private void Form1_Load(object sender, EventArgs e)
{
//timer1.Start();
System.Timers.Timer timer = new System.Timers.Timer();
timer.Interval = 1000;
timer.Elapsed += Timer_Elapsed;
timer.Start();
}
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
//Update label in multiple thread
Invoke(new MethodInvoker(delegate ()
{
lblStatus.Text = DateTime.Now.ToString("T");
}));
}
}
}
VIDEO TUTORIALS