How to stop a timer after some numbers of ticks or after, let\'s say, 3-4 seconds?
So I start a timer and I want after 10 ticks or after 2-3 seconds to stop autom
When the timer's specified interval is reached (after 3 seconds), timer1_Tick()
event handler will be called and you could stop the timer within the event handler.
Timer timer1 = new Timer();
timer1.Interval = 3000;
timer1.Enabled = true;
timer1.Tick += new System.EventHandler(timer1_Tick);
void timer1_Tick(object sender, EventArgs e)
{
timer1.Stop(); // or timer1.Enabled = false;
}