Salvador
Salvador

Reputation: 16482

.Net equivalent for the TTimer Delphi component

Exist a .net class equivalent to the TTimer delphi component?

TTimer is used to simplify calling the Windows API timer functions SetTimer and KillTimer, and to simplify processing the WM_TIMER messages. Use one timer component for each timer in the application.

The execution of the timer occurs through its OnTimer event. TTimer has an Interval property that determines how often the timer's OnTimer event occurs. Interval corresponds to the parameter for the Windows API SetTimer function.

Thanks in advance.

Upvotes: 2

Views: 379

Answers (3)

Will Marcouiller
Will Marcouiller

Reputation: 24132

Here's probably what you want: Timer Component (Windows Form)

And since there are more than only one Timer in .NET, here's a place where they compare them and explains the differences: Comparing the Timer Classes in the .NET Framework Class Library

Upvotes: 2

itowlson
itowlson

Reputation: 74802

Several! The closest to the Delphi TTimer is probably System.Windows.Forms.Timer, but there are also System.Timers.Timer and System.Threading.Timer for use in non-WinForms environments.

Upvotes: 5

Matthew Olenik
Matthew Olenik

Reputation: 3577

Perhaps System.Diagnostics.Stopwatch will do what you want?

Edit: Sorry, I didn't realize that Stopwatch doesn't provide events. As itowlson mentioned, use System.Windows.Form.Timer or System.Threading.Timer.

Upvotes: 0

Related Questions