This documentation is archived and is not being maintained.

Timer.Stop Method

Stops raising the Elapsed event by setting Enabled to false.

[Visual Basic]
Public Sub Stop()
[C#]
public void Stop();
[C++]
public: void Stop();
[JScript]
public function Stop();

Remarks

You can also stop timing by setting Enabled to false.

Note   The event-handling method might be called even after the Stop method is called. The Timer component is multithreaded to ensure more accuracy. However, this means that the call to the event-handling method might run on one thread at the same time that a call to the Stop method runs on another thread. This might result in the Elapsed event being raised even after the Stop method is called. To prevent this, use the SignalTime property to compare the time the event was raised to the time the Stop method was called. If the event was raised after the Stop method was called, do not process the event.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Timer Class | Timer Members | System.Timers Namespace | Enabled | Start | Elapsed

Show: