using 2 timers, need to increment and end the loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • clubber Lau
    New Member
    • Sep 2006
    • 2

    using 2 timers, need to increment and end the loop

    Sorry in advance if this has been answered here before. I did my best to search before posting.

    I'm working on a boxing timer to use when i hit my heavybag. I have 2 timers going. one to count down the 3minute rounds and one to count down the 1 minute rest inbetween rounds.

    both timers have these if statements in them and the timer works great, the only problem is that it just continues on and on forever. since both timers have their own Private sub section i can't figure out where to place the for-next-end statement so that i can increment the round counter and end after the number of rounds I specify. Is there a way to insert those private sub sections?

    the project looks like this:

    declarations
    sub setLabel
    sub setLabel
    private sub cmdStart_Click <---starts Timer1
    private sub frmMain_Load
    private sub frmMain_FormClo sed
    private sub Timer1_Tick <--- counts down 3mins, stops itself, starts Timer2
    private sub Timer2_Tick <------counts down 1min, stops itself, starts Timer1
  • KenMacksey
    New Member
    • Sep 2006
    • 6

    #2
    Originally posted by clubber Lau
    Sorry in advance if this has been answered here before. I did my best to search before posting.

    I'm working on a boxing timer to use when i hit my heavybag. I have 2 timers going. one to count down the 3minute rounds and one to count down the 1 minute rest inbetween rounds.

    both timers have these if statements in them and the timer works great, the only problem is that it just continues on and on forever. since both timers have their own Private sub section i can't figure out where to place the for-next-end statement so that i can increment the round counter and end after the number of rounds I specify. Is there a way to insert those private sub sections?

    the project looks like this:

    declarations
    sub setLabel
    sub setLabel
    private sub cmdStart_Click <---starts Timer1
    private sub frmMain_Load
    private sub frmMain_FormClo sed
    private sub Timer1_Tick <--- counts down 3mins, stops itself, starts Timer2
    private sub Timer2_Tick <------counts down 1min, stops itself, starts Timer1

    Just some thoughts since I am not really experienced at this.

    use cmdStart_Click to pop up an inputbox

    Rounds = Inputbox("Enter # Of Rounds. ")

    then run a loop based on # of rounds.

    for i = 1 to Rounds

    call timer1_tick
    ' have timer one call timer 2 but remove the callback to timer 1 from timer 2 sub
    ' Timer 1 will start again with the next loop

    next i

    *** note *** code is untested, but should point you in the right direction.


    HTH

    Ken

    Comment

    • clubber Lau
      New Member
      • Sep 2006
      • 2

      #3
      I got it working now, thanks for the advice. I just used if than statments in the timer subs and incremented at the end of one timer.

      you can see my boxing timer here

      Comment

      Working...