Page 1 of 1

Periodic Timers - how to prevent autostart?

Posted: Mon Mar 25, 2013 6:43 am
by smolenak
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!

Re: Periodic Timers - how to prevent autostart?

Posted: Mon Mar 25, 2013 7:58 am
by Edmund
Remove

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?

Posted: Tue Mar 26, 2013 5:06 am
by smolenak
That's it - thanks a lot, Edmund!! :)