Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42732

Timer Problem Help Needed!!!

$
0
0
Hi All

I have a problem with the code below when I click start it counts down from 20 in the label which its fine, if I click the stop button which stops the timer
it stops the count at that time in the label which is fine, the problem lies when i start the timer again it starts counting down but stops at 4/5 Secs. the reason why the code is written in that way in timer1 section is becuase in my main code it search's for a file if exists within 20 secs it stops the timer but the same probelm exists in this code below has well.

Regards

Steve

Private Sub Command1_Click()
Timer1.Enabled = True
Label1.Caption = "20"
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
Label1.Caption = "20"
End Sub

Private Sub Timer1_Timer()
Label1.Caption = Label1.Caption - 1


Static TickCounter As Integer
If TickCounter < 20 Then
TickCounter = TickCounter + 1
Else
Timer1.Enabled = False
TickCounter = 0
End If
End Sub

Viewing all articles
Browse latest Browse all 42732

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>