Timer Constructor (Double)

 

Initializes a new instance of the Timer class, and sets the Interval property to the specified number of milliseconds.

Namespace:   System.Timers
Assembly:  System (in System.dll)

public:
Timer(
	double interval
)

Parameters

interval
Type: System::Double

The time, in milliseconds, between events. The value must be greater than zero and less than or equal to Int32::MaxValue.

Exception Condition
ArgumentException

The value of the interval parameter is less than or equal to zero, or greater than Int32::MaxValue.

This constructor sets the Interval property of the new timer instance, but does not enable the timer.

The following example instantiates a Timer object that fires its Timer::Elapsed event every two seconds (2000 milliseconds), sets up an event handler for the event, and starts the timer. The event handler displays the value of the ElapsedEventArgs::SignalTime property each time it is raised.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: