need help in this code (vb6)

Status
Not open for further replies.

arian29

In the zone
can someone please assist me with the code. its not working.
:confused:
'------------------------countdown timer Code-----------------------------------
Option Explicit

Private m_StopTime As Date

Private Sub cmdGo_Click()
Dim fields() As String
Dim hours As Long
Dim minutes As Long
Dim seconds As Long

fields = Split(txtDuration.Text, ":")
hours = fields(0)
minutes = fields(1)
seconds = fields(2)

m_StopTime = Now
m_StopTime = DateAdd("h", hours, m_StopTime)
m_StopTime = DateAdd("n", minutes, m_StopTime)
m_StopTime = DateAdd("s", seconds, m_StopTime)

tmrWait.Enabled = True

End Sub '>> it stops here dosent go to Sub tmrWait_Timer()


Private Sub tmrWait_Timer()

Dim time_now As Date
Dim hours As Long
Dim minutes As Long
Dim seconds As Long

time_now = Now
If time_now >= m_StopTime Then
MsgBox ("ok")
tmrWait.Enabled = False
lblRemaining.Caption = "0:00:00"
Else
seconds = DateDiff("s", time_now, m_StopTime)
minutes = seconds \ 60
seconds = seconds - minutes * 60
hours = minutes \ 60
minutes = minutes - hours * 60

lblRemaining.Caption = _
Format$(hours) & ":" & _
Format$(minutes, "00") & ":" & _
Format$(seconds, "00")
End If
End Sub
 
Status
Not open for further replies.
Top Bottom