System.Windows.Forms.Timer.Stop Method

Stops the timer.

Syntax

public void Stop ()

Remarks

You can also stop the timer by setting the Timer.Enabled property to false. A System.Windows.Forms.Timer object may be enabled and disabled multiple times within the same application session.

Calling Timer.Start after you have disabled a System.Windows.Forms.Timer by calling Timer.Stop will cause the System.Windows.Forms.Timer to restart the interrupted interval. If your System.Windows.Forms.Timer is set for a 5000-millisecond interval, and you call Timer.Stop at around 3000 milliseconds, calling Timer.Start will cause the System.Windows.Forms.Timer to wait 5000 milliseconds before raising the Timer.Tick event.

Note:

Calling Stop on any System.Windows.Forms.Timer within a Windows Forms application can cause messages from other System.Windows.Forms.Timer components in the application to be processed immediately, because all System.Windows.Forms.Timer components operate on the main application thread. If you have two System.Windows.Forms.Timer components, one set to 700 milliseconds and one set to 500 milliseconds, and you call Timer.Stop on the first System.Windows.Forms.Timer, your application may receive an event callback for the second component first. If this proves problematic, consider using the System.Threading.Timer class in the System.Threading namespace instead.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0