Use Of Timer Control...


 

private void Form1_Load(object sender, EventArgs e)
{
//Take One New timer...
Timer timer1 = new Timer();

//Add Tick Event Of Timer
this.timer1.Tick+=new EventHandler(this.timer1_Tick);
timer1.Enabled = true;

//Start The Timer...
timer1.Start();
}

private void timer1_Tick(object sender, EventArgs e)
{
//Display Current Date & Time Both...
lblTime.Text = DateTime.Now.ToString();

//For Only Time Use Below Line Instead Of First...
lblTime.Text = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString();
}


Ebook Download
View all
Learn
View all