Controlling cycles of timers/panel color changes in code at starting click event

Oct 16 2009 10:22 PM

I'm at a beginner level using VB.Net, 2008

I'm doing a small project to learn how to control timers.

I have a Button click event which, in its sub, starts seven timers

Each timer has its own sub that, in their subs, makes some color changes.

I want the program to sequence through these seven timers/colors โ€“ in order โ€“ up to 10 times and I do not understand how to get back to and start the click event again in code.

Presently the program basically runs through the cycles properly but with no control over how many cycles can be performed.

How do I get the program to loop through starting at the click event ONLY the 10 times (see shortened code below) and QUIT cycling without quitting the program? (Other Buttons will be added for other events.)

I would really appreciate any suggestions.



Form Load

                Set all seven timers Intervals individually

Button Click

                Enable all seven timers individually

 

Private Sub tmr1

                Change Panel1 BackColor

 

Private Sub tmr2

                Panel1 BackColor change back to Transparent

                Change Panel2 BackColor

 

Private Sub tmr3

                Panel2 BackColor change back to Transparent

                Change Panel3 BackColor

 

Private Sub tmr4

                Panel3 BackColor change back to Transparent

                Change Panel4 BackColor

 

Private Sub tmr5

                Panel4 BackColor change back to Transparent

                Change Panel5 BackColor

 

Private Sub tmr6

                Panel5 BackColor change back to Transparent

                Change Panel6 BackColor

 

Private Sub tmr7

                Panel6 BackColor change back to Transparent

                Disable all timers individually

                Reset all timer intervals individually

                Enable all timers individually



Private Sub tmr 7 resets the timers and recycles the run through the timers, but, I would like to continue the code here to control the number of times it does cycle. I could not control it with a DO statement. Any ideas?



Thanks  -  JG


Answers (1)