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

Recommended Answers

All 4 Replies

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

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

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.