Discussion in 'Questions (Windows Mobile)' started by davelew1s, Aug 3, 2007.

  1. davelew1s

    davelew1s Active Member Licensed User

    I'm writing an app which uses the serial ports, so far it almost works, using Timers..I have a few questions on Timers:-
    1...Is it OK to use more than 1 timer at a time, it does work but is good/bad
    2...If more than 1 is used when do they fire..are they connected in any way or does it depend on when they are Enabled?
    3...Is it good or bad to jump to a Sub from within a timer, if you do does the timer still fire or is it suspended until it is exited..similar if you stay in a timer longer then the interval does it still fire?
    Anyone got any thoughts on these?
  2. Erel

    Erel Administrator Staff Member Licensed User

    1. There is no problem with using several timers.
    2. They are not connected in any way.
    Theoretically, each one will wait for its interval and then fire.
    However timers can't fire when the processor is busy and not handling internal messages.
    For example if you create an endless loop, timers will not fire at all.
    That is unless you use the DoEvents keyword in the loop.
    3. As written above, the timer will only fire after finishing the sub (and any other code in the Timer_Tick event).

    You should set an interval that is large enough for the processor to finish all the code, otherwise it will just run slower.
  3. davelew1s

    davelew1s Active Member Licensed User

    Thanks Erel that makes things a lot clearer.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice