Hi Vijaya,
Sry i couldn't attach code here, but do as i per my instructions.
Put Timer Control on Form and Set Interval Property to 1000 miliseconds.
Define hour, minute and second as private integer variable of Form1 as below:
int hh=0,m==0,ss=0;
Put Lable control on Form:
Set Text property of Label control in Form_Load event
private void Form1_Load(Object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString("hh:mi:ss tt");
}
then write code for Timer1_Tick event:
private void Timer1_Tick(Object sender, EventArgs e )
{
ss++;
if(ss==60)
{
ss=0;
mm++;
}
if(mm==60)
{
ss=0;
mm=0;
hh++;
}
Label1.Text = string.Format("{0}:{1}:{2}", hh,mm,ss);
}
put a button to stop timer and write code on it's click event
private button1_Click(Object sender, EventArgs e )
{
Timer1.Stop()
}
Hope this code will helps you
Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/
Vijayar, if this helps please login to Mark As Answer. | Alert Moderator