Fred Wayne
Member
I have made a digital clock timer. it works perfectly, but I don´t not know why instead of displaying "00:00:00", it displays "12:00:02". This is the code I used:
I have skimmed from A to Z and can not find out the why it displays in an incorrect way. It supposes to displays the seconds, and then the minutes according to the time running. I would like you to let me if I am doing anything wrong. I have some screenshots and the original file of the Timer. Thank you so much once again in advance.
Code:
Dim dteStart As Date, dteFinish As Date
Dim dteStopped As Date, dteElapsed As Date
Dim boolStopPressed As Boolean, boolResetPressed As Boolean
Private Sub btnReset_Click()
dteStopped = 0
dteStart = 0
dteElapsed = 0
Label1 = "00:00:00"
boolResetPressed = True
End Sub
Private Sub btnStart_Click()
Start_timer:
dteStart = Time
boolStopPressed = False
boolResetPressed = False
Timer_Loop:
DoEvents
dteFinish = Time
dteElapsed = dteFinish - dteStart + dteStopped
If Not boolStopPressed = True Then
Label1 = dteElapsed
If boolResetPressed = True Then GoTo Start_timer
GoTo Timer_Loop
Else
Exit Sub
End If
End Sub
Private Sub btnStop_Click()
boolStopPressed = True
dteStopped = dteElapsed
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_INITIALIZE()
Label1 = "00:00:00"
End Sub
I have skimmed from A to Z and can not find out the why it displays in an incorrect way. It supposes to displays the seconds, and then the minutes according to the time running. I would like you to let me if I am doing anything wrong. I have some screenshots and the original file of the Timer. Thank you so much once again in advance.
Attachments
Last edited by a moderator: