Apologies in advance if this question is addressed somewhere...I have not found it if it is. Anywhoo...
In using TimeAdd within a Countdown Timer project, I accept numbers as input from the user and insert those values into the TimeAdd(x, H, M, S). Then I use that info to give me the time to count down. Here is the problem: If I try to enter greater than 24 hours as the user, and display the time in hours, minutes and seconds as it counts down, the hours turns to '0' for 25, and adds 1 for each value above 24 hours. Just curious why this is happening.
Here's part of the code:
Code:
Sub Start_Click
H = H.Text
M = M.Text
S = S.Text
HMS.Visible=True
Timer1.Enabled = True
Timer1.Interval = 1000
Timer2.Interval = 30000 '30 seconds
Timer2.Enabled = True
If IsNumber(H)=True AND IsNumber(M)=True AND IsNumber(S)=True Then
x=Now
StartTime = TimeAdd(x, H, M, S)
Diff = (StartTime-x)/cTicksPerSecond
Start.Visible = False
Pause.Visible = True
Else
Message_Box
Timer1.Enabled=False
Timer2.Enabled=False
Display.Text=""
M.Focus
Start.Visible = True
Pause.Visible = False
End If
If H=0 AND M=0 AND S=0 Then
Message_Box
Timer1.Enabled=False
Timer2.Enabled=False
'Display.Text=""
H.Focus
Start.Visible = True
Pause.Visible = False
TH=0
TS=0
TM=0
End If
End Sub
Sub Timer1_Tick
Diff=Diff-1
If Diff = 0 Then
Timer1.Enabled = False
Timer2.Enabled = False
Start.Visible = True
Pause.Visible = False
Sound("untie.wav")
End If
Display.Text=Diff
If H=0 AND M=0 AND S=0 Then
Reset_Click
Else
TM=TimeMinute(Diff*cTicksPerSecond)
TH=TimeHour(Diff*cTicksPerSecond)
TS=TimeSecond(Diff*cTicksPerSecond)
End If
HMS.Text = "Hrs: " & TH & " Mins: " & TM & " Secs: " & TS
End Sub
Thanks in advance.
