Implements a timer that raises an event at user-defined intervals. This timer is optimized for use in Windows Forms applications and must be used in a window.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Gets a value indicating whether the component can raise an event.(Inherited from Component.)
Gets or sets whether the timer is running.
Gets or sets an arbitrary string representing some type of user state.
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)
Disposes of the resources, other than memory, used by the timer.(Overrides Component.Dispose(Boolean).)
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Serves as the default hash function. (Inherited from Object.)
Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)
Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)
Raises the Tick event.
Starts the timer.
Stops the timer.
This API supports the product infrastructure and is not intended to be used directly from your code. Returns a string that represents the Component.ToString().).(Overrides
Ais used to raise an event at user-defined intervals. This Windows timer is designed for a single-threaded environment where UI threads are used to perform processing. It requires that the user code have a UI message pump available and always operate from the same thread, or marshal the call onto another thread.
When you use this timer, use the Tick event to perform a polling operation or to display a splash screen for a specified period of time. Whenever the Enabled property is set to true and the Interval property is greater than zero, the Tick event is raised at intervals based on the Interval property setting.
This class provides methods to set the interval, and to start and stop the timer.
Legacy Code Example
The following example implements a simple interval timer, which sets off an alarm every five seconds. When the alarm occurs, a MessageBox displays a count of the number of times the alarm has started and prompts the user as to whether the timer should continue to run.
Available since 1.1
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.