Timer Control

Description

The Timer is a control that raises an event at regular intervals. It is executable even when the emergency stop occurs or other normal tasks are paused.

Usage

Use the Timer control to periodically execute code.
For example, a Timer control could be used to update a status label every two seconds.

To use a Timer

  1. Add a Timer control to a form. The control is displayed below the form in the design area, since this control is invisible at runtime.
  2. Set the Interval property to the desired time period in milliseconds.
  3. Set the Enabled property to True at design time if the timer should always run. Otherwise, set the Enabled property to True at runtime in your code.
  4. Add an event handler for the Tick event to execute your code.

KEY POINTS


When a timer is executing the Tick event handler, other tick events from the same timer are ignored.

Timer Control Properties

Property Description
Enabled

Sets whether the control is enabled.

Default: False

Interval

Sets the time interval in milliseconds

Default: 100

Name

The name of the control.

Default: TimerXX

Timer Control Events

Event Description
Tick Occurs when the time is enabled and the interval has been reached.