Hello
I need to count down (from 2 hours) the time - in other words count backwards from 1:59:59 to 00:00:00
This is what I've done so far, can anyone help me improve
VB Code:
Private Sub ETCountDown() Static ETSec As Integer = 60 Static ETMin As Integer = 59 Static ETHour As Integer = ETDur - 1 '''''''''''''''''''''''''''''''''' 'seconds ETSec = ETSec - 1 lblETTimeLeft.Text = CStr(ETHour) & ":" & CStr(ETMin) & ":" & CStr(ETSec) If ETSec = 0 Then ETMin = ETMin - 1 lblETTimeLeft.Text = CStr(ETHour) & ":" & CStr(ETMin) & ":00" ETSec = 59 ElseIf ETSec < 10 Then lblETTimeLeft.Text = CStr(ETHour) & ":" & CStr(ETMin) & ":0" & CStr(ETSec) End If ''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''' 'minutes not too sure! If ETMin = 0 Then ETHour = ETHour - 1 lblETTimeLeft.Text = CStr(ETHour) & ":00" & CStr(ETSec) ETMin = 59 ElseIf ETMin < 10 Then If ETSec < 10 Then lblETTimeLeft.Text = CStr(ETHour) & ":0" & CStr(ETMin) & ":0" & CStr(ETSec) Else lblETTimeLeft.Text = CStr(ETHour) & ":0" & CStr(ETMin) & ":" & CStr(ETSec) End If End If ''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''' 'hour busy If ETHour = 0 Then lblETTimeLeft.Text = "00:" & CStr(ETMin) & ":" & CStr(ETSec) ElseIf ETHour < 10 Then lblETTimeLeft.Text = "0:" & CStr(ETMin) & ":" & CStr(ETSec) End If End Sub Private Sub tET_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tET.Tick ETCountDown() 'interval is set to 1000 End Sub




Reply With Quote