help with this crazy timer please...
Posted: Thu Aug 09, 2012 1:17 pm
ok so i have a label in a UserControl.

i am having some issues getting to work @ all and display the proper countdown result.
these are the main VARs for the timer to use @ Load_Event
50cc to the one that figures this out and get it working right.
plus if you want to use a BackgroundWorker seeing how main of these timers can be running at once you can.

i am having some issues getting to work @ all and display the proper countdown result.
Code: Select all
Public Class mainTimer
Dim Days As Integer = 0
Dim Hrs As Integer = 0
Dim Mins As Integer = 0
Dim Secs As Integer = 0
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Me.Dispose()
End Sub
Private Sub mainTimer_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 1000
Timer1.Enabled = False
Dim Days As Integer = 0
Dim Hrs As Integer = 0
Dim Mins As Integer = 5
Dim Secs As Integer = 0
tmrResult.Text = Days.ToString + ":" + Hrs.ToString + ":" + Mins.ToString + ":" + Secs.ToString
Try
Timer1.Enabled = True
Timer1.Start()
Catch ex As Exception
End Try
End Sub
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
If Days > 0 Then
Days = Days - 1
Hrs = 23
Mins = 59
Secs = 59
tmrResult.Text = Days.ToString + ":" + Hrs.ToString + ":" + Mins.ToString + ":" + Secs.ToString
ElseIf Hrs > 0 Then
Hrs = Hrs - 1
Mins = 59
Secs = 59
tmrResult.Text = Days.ToString + ":" + Hrs.ToString + ":" + Mins.ToString + ":" + Secs.ToString
ElseIf Mins > 1 Then
Mins = Mins - 1
Secs = 59
tmrResult.Text = Days.ToString + ":" + Hrs.ToString + ":" + Mins.ToString + ":" + Secs.ToString
ElseIf Secs > 1 Then
Secs = Secs - 1
tmrResult.Text = Days.ToString + ":" + Hrs.ToString + ":" + Mins.ToString + ":" + Secs.ToString
ElseIf Days = 0 AndAlso Hrs = 0 AndAlso Mins = 0 AndAlso Secs = 0 Then
'set alert types and functions
End If
End Sub
End Class
these are the main VARs for the timer to use @ Load_Event
Code: Select all
can i get any help? Dim Days As Integer = 0
Dim Hrs As Integer = 0
Dim Mins As Integer = 5
Dim Secs As Integer = 0
50cc to the one that figures this out and get it working right.
plus if you want to use a BackgroundWorker seeing how main of these timers can be running at once you can.