I have tried this example:
http://ixtalk.beijerelectronics.us/view ... hp?f=9&t=5
But my question is, how could I prevent the timer from starting right after when the application is started? Now it starts counting automatically, and that's why I cannot use it properly.
Thanks in advance!
Periodic Timers - how to prevent autostart?
Re: Periodic Timers - how to prevent autostart?
Remove
From the constructor.
So it looks like this
Code: Select all
timer1.Enabled = true;
timer2.Enabled = true;
From the constructor.
So it looks like this
Code: Select all
static TimerScript()
{
timer1 = new Timer();
timer1.Tick += new EventHandler(TimeOut1);
timer1.Interval = 1000;
timer2 = new Timer();
timer2.Tick += new EventHandler(TimeOut2);
timer2.Interval = 250;
}
Re: Periodic Timers - how to prevent autostart?
That's it - thanks a lot, Edmund!!