System.Windows.Forms 1.0.5000.0 2.0.0.0 System.ComponentModel.Component System.ComponentModel.ToolboxItemFilter("System.Windows.Forms", System.ComponentModel.ToolboxItemFilterType.Allow) System.ComponentModel.DefaultEvent("Tick") System.ComponentModel.DefaultProperty("Interval") A is 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 event to perform a polling operation or to display a splash screen for a specified period of time. Whenever the property is set to true and the property is greater than zero, the event is raised at intervals based on the property setting. This class provides methods to set the interval, and to start and stop the timer. The Windows Forms Timer component is single-threaded, and is limited to an accuracy of 55 milliseconds. If you require a multithreaded timer with greater accuracy, use the class in the namespace. 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. Constructor When a new timer is created, it is disabled; that is, is set to false. To enable the timer, call the method or set to true. If the timer is disabled and the timer is out of scope, the timer will be disposed when garbage collection occurs. If the timer is enabled, even if it is out of scope, it is not subject to garbage collection. Initializes a new instance of the class. 1.0.5000.0 2.0.0.0 Constructor The constructor enables you to associate a with any object. By associating the like this, you hand over control of the lifetime of the to the . This can be useful if you use a number of components in your application and want to dispose of all of them simultaneously. For example, if you associate a , an , and a with a , calling on the will force disposal of all of these components as well. When a new timer is created, it is disabled; that is, is set to false. To enable the timer, call the method or set to true. This instance will exist until its container releases it to garbage collection. Initializes a new instance of the class together with the specified container. An that represents the container for the timer. 1.0.5000.0 2.0.0.0 Method System.Void Call when you are finished using the timer. The method leaves the timer in an unusable state. After you call , you must release all references to the timer so the memory it was occupying can be reclaimed by garbage collection. Always call before you release your last reference to the timer. Otherwise, the resources the timer is using will not be freed until garbage collection calls the destructor of the timer object. Disposes of the resources, other than memory, used by the timer. true to release both managed and unmanaged resources. false to release only the unmanaged resources. 1.0.5000.0 2.0.0.0 Property System.ComponentModel.DefaultValue(false) System.Boolean To be added. The timer is not subject to garbage collection when the value is true. Calling the method is the same as setting to true. Likewise, calling the method is the same as setting to false. Gets or sets whether the timer is running. 1.0.5000.0 2.0.0.0 Property System.ComponentModel.DefaultValue(100) System.Int32 To be added. To get the number of seconds in the interval, divide this number by 1,000. Gets or sets the time, in milliseconds, before the event is raised relative to the last occurrence of the event. 1.0.5000.0 2.0.0.0 Method System.Void This method is called for each timer tick. It calls any methods that are added through . If you are inheriting from , you can override this method. Raising an event invokes the event handler through a delegate. For more information, see Raising an Event. Raises the event. An that contains the event data. This is always . 1.0.5000.0 2.0.0.0 Method System.Void You can also start the timer by setting the property to true. Starts the timer. 1.0.5000.0 2.0.0.0 Method System.Void You can also stop the timer by setting the property to false. A object may be enabled and disabled multiple times within the same application session. Calling after you have disabled a by calling will cause the to restart the interrupted interval. If your is set for a 5000-millisecond interval, and you call at around 3000 milliseconds, calling will cause the to wait 5000 milliseconds before raising the event. Calling Stop on any within a Windows Forms application can cause messages from other components in the application to be processed immediately, because all components operate on the main application thread. If you have two components, one set to 700 milliseconds and one set to 500 milliseconds, and you call on the first , your application may receive an event callback for the second component first. If this proves problematic, consider using the class in the namespace instead. Stops the timer. 1.0.5000.0 2.0.0.0 Property System.ComponentModel.DefaultValue(null) System.ComponentModel.TypeConverter(typeof(System.ComponentModel.StringConverter)) System.ComponentModel.Bindable(true) System.ComponentModel.Localizable(false) System.Object To be added. To be added. Gets or sets an arbitrary string representing some type of user state. 2.0.0.0 Event System.EventHandler Calling the method on the class from within the event may not behave as expected, as displaying the assertion dialog box may cause Windows to raise the event repeatedly. We recommend that you refrain from testing assertions within this event, and use the , , , or methods instead. For more information about handling events, see Consuming Events. Occurs when the specified timer interval has elapsed and the timer is enabled. 1.0.5000.0 2.0.0.0 Method System.String The method returns a string that includes the value of the property. Returns a string that represents the . A string that represents the current . 1.0.5000.0 2.0.0.0