I have found many countdown timers but not one that works the way that I am looking. I am trying to have a countdown timer in a button that will change the text. Once you click "Timer" it changes to the time and counts down from minutes and seconds. It will pull the minutes form textbox. I have seen several examples that changes labels and has multiple textboxes or buttons. I just want something very simple. I have a count up timer that works the way that I want but id prefer a count down.
Heres my count up timer:
Im not looking for the straight code however I would appreciate if there are any tutorials or any resources that are known that could point me in the right direction.
Or if possible, is there a way to set a count up limit so that once it reaches say, 45 minutes that it stops or has a msgbox?
Heres my count up timer:
Code:
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
If Timer2.Enabled = True Then
Timer2.Stop()
Else
Time = DateTime.Now
Timer2.Start()
End If
If Button4.Text = "Timer" Then
Button4.Text = ""
Else
Button4.Text = "Timer"
End If
End Sub
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
Dim Difference As TimeSpan = DateTime.Now.Subtract(Time)
Button4.Text = Difference.Minutes.ToString & ":" & Difference.Seconds.ToString
End Sub
Or if possible, is there a way to set a count up limit so that once it reaches say, 45 minutes that it stops or has a msgbox?