1.11M Members

Reset the counter

 
0
 

Hello everyone
In my app i'm using the counter and timer, But im stuck with resetting the counter
My code is:

If Timer2.Enabled = True Then
            counter = counter + 1   
            Label1.Text = counter    
            If Label1.Text = "180" Then
                Timer2.Enabled = false
                    Timer3.Enabled  = true 
                End If
            End If
            End Sub

 If Timer3.Enabled =  true then
            counter = counter + 1
            Label2.Text = counter 
            If Label1.Text = "80" Then
            Timer3.Enabled = False
            end if

But the problem is: When the second counter starts, It does continue on the first counter after it's stops which is 180, But what i was aiming for is to second counter to start from 0
Any idea?
Thanks

 
1
 

I have no way of knowing where your code is being executed. Is any of the code inside the timer Tick event handlers? For what you are trying to do I would put the following code in the Timer2_Tick handler

counter += 1
Label1.Text = counter

If counter = 180 Then
    counter = 0
    Timer2.Enabled = false
    Timer3.Enabled = true
End If

then in Timer3_Click I would put

counter += 1
label2.Text = counter

If counter = 80 Then
    Timer3.Enabled = False
End If
 
0
 

Thanks Jim, It really helped me
Sorry for the late reply as i been away thats why i didn't let you you know if it did work
Thanks as always

 
0
 

Any time. I'll mark this as solved.

Question Answered as of 1 Year Ago by Reverend Jim
 
0
 

Thanks

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: