I am writing a simple program. I want to select the date and time, it should appear like this: DAYS HOURS MINUTES SECONDS
when the time reached set date my timer must stop like this 0(d) 0(h) 0(m) 0(s) and show Form2. But my timer continues to count from 0 to negative. i dont know how can i stop the timer. Maybe this is something easy i just cant remember the syntax how to do it.. please help :)

Thanks in advance

Public Class Form1
Dim CurrentTime
Dim TargetTime

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Enabled = False

End Sub

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
CurrentTime = NowDim RemTime = TargetTime - CurrentTime
txtDays.Text = RemTime.days
txtHours.Text = RemTime.hours
txtMinutes.Text = RemTime.minutes
txtSeconds.Text = RemTime.seconds

End Sub

Private Sub btnOn_Click(sender As Object, e As EventArgs) Handles btnOn.Click
TargetTime = txtDateTime.Value
Timer1.Enabled = True
txtDateTime.Visible = False
btnOn.Visible = False
End Sub

End Class
2 Months
Discussion Span
Last Post by rproffitt

I see you know about Timer1.Stop so why not in your Timer1 handler test for the value to be zero or less then stop the timer and call up your new form?

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.