First: Sorry my english
My function is working to countdown my time (TEMPO), but sometimes, it´s not show the second.
Ex: My function show the time in btnTIMER.Text (button): 10:09. (1s)..10:08.(1s)..10:07....(3s)......10:06.10:05.10:04
It doesn't show the time every second as it should
What can i do??
My function is working to countdown my time (TEMPO), but sometimes, it´s not show the second.
Ex: My function show the time in btnTIMER.Text (button): 10:09. (1s)..10:08.(1s)..10:07....(3s)......10:06.10:05.10:04
It doesn't show the time every second as it should
What can i do??
TIMER:
Private Sub countDown(seconds As Int)
Dim StartTime As Long = DateTime.Now + (TEMPO * 60000) + (seconds * 1000)
Dim hours, minutes, seconds As Int
' Dim countDownEnabled = True
Do While countDownEnabled
Dim count As Int = (DateTime.now - StartTime) / 1000
If count >= seconds Then
countDownEnabled = False
btnTIMER.text = "00:00"
btnTIMER.Enabled = True
Exit
End If
'Log(seconds - count) 'or update display
t = Abs(count)
hours = t / DateTime.TicksPerHour
minutes = (t Mod DateTime.TicksPerHour) / DateTime.TicksPerMinute
seconds = (t Mod DateTime.TicksPerMinute) / DateTime.TicksPerSecond
minutes = t/60
seconds = t - minutes * 60
If t < 0 Then
btnTIMER.text = "00:00"
btnTIMER.Enabled = True
Else
btnTIMER.text = NumberFormat(minutes, 2, 0) & ":" & NumberFormat(seconds, 2, 0)
If btnTIMER.Text="00:00" Then ' ----------- 0 min
Timer2.Enabled = False
Vibra_Toca (True, True, 0)
Sleep(5000)
btnTIMER_LongClick
End If
End If
Sleep(400)
Loop
End Sub