• Have Any Question?
  • contact@eitworld.com

csharp.net timer control





    • Timer controls are controls that are used to generate periodic events.
    • These controls are called components and they do not appear in a Window at run time.
    • At design time they appear in the component tray below the form in which they are added.
    • You can place a Timer control on the form by drag and drop it from the toolbox. The Timer control looks like as follows:

timer-control

Properties of Timer Control

Some of the commonly used properties of Timer Control are listed below in the Table:

timer-control

Methods of Timer Control

Some of the commonly used methods of Timer Control are listed below in the Table:

timer-control

Events of Timer Control

Some of the commonly used events of Timer Control are listed below in the Table:

timer-control

Example

Here is a simple example of Timer control. To understand the use of the Timer control follows the given steps:

    • Add a Label control and Timer control to Form from the ToolBox.
    • Now select the Timer control and open its properties window and change its Enabled property to True.
    • Now click on the Events icon and double click inside the combo box next to Tick event.
    • The Code window will appear. Add the following code in Timer_Tick event handler:
private void timer1_Tick(object sender, EventArgs e)
{
label1.Text = DateTime.Now.ToString();
}

    • Now run the application by pressing F5 key. You will get the following output:

timer-control



Real Time Web Analytics