Thursday, July 5, 2012

Live Running System Clock in C# form


public partial class parent : Form
{
        Timer clock;

        public parent()
        {
            InitializeComponent();    
        }

       private void parent_Load(object sender, EventArgs e)
       {
           clock = new Timer();
           clock.Interval = 1000;
           clock.Start();
           clock.Tick += new EventHandler(Timer_Tick);
       }

     
       public void Timer_Tick(object sender, EventArgs eArgs)
       {  
           if (sender == clock)
           {
              lblLiveUp.Text = DateTime.Now.ToString();
           }
       }
}

No comments:

Post a Comment