Skip to main content

Problem:

If you are processing a Timer event and it takes a while processing then when the event is finished the next timer event is immediately fired.

How can you stop event while processing another?

Resolution:

In the event you can switch off a time and then start it at the end of the  event. Some example code for this is:-

       method-id.  "timer1_Tick" final private.

       linkage section.

       01 sender System-Object.

       01 e System-EventArgs.

       procedure division using by value  sender e.

           

          invoke timer1::"Stop"()

       

           invoke cThread::"Sleep"(10000)

      *****     invoke cMessageBox::"Show"("Timer has Fired !")

          invoke timer1::"Start"()

       

       end method "timer1_Tick".

Old KB# 3923