Friday, December 01, 2006

Timers in C#

From msdn2.microsoft.com
private void CreateTimer()
{
System.Timers.Timer Timer1 = new System.Timers.Timer();
Timer1.Enabled = true;
Timer1.Interval = 5000;
Timer1.Elapsed +=
new System.Timers.ElapsedEventHandler(Timer1_Elapsed);
}

private void Timer1_Elapsed(object sender,
System.Timers.ElapsedEventArgs e)
{
System.Windows.Forms.MessageBox.Show("Elapsed!",
"Timer Event Raised!");
}

No comments: