I'm trying to stop and than start my timer again at the point that I stopped it. I'm able to stop it, but when I click to continute counting down, it does continue but not where I stoped it, continues from the point where it would be as if I never stopped it. I guess it runs in the background. It shouldn't these 3 subs show all I do with the timer.
Private Sub Start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.alarmTime = Date.Now.AddMinutes(15.02)
Me.Timer1.Enabled = True
Me.Timer1.Start()
End Sub
Private Sub StopRestart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Button2.Text = "Stop Timer" Then
Me.Timer1.Stop()
Button2.Text = "Restart Timer"
ElseIf Button2.Text = "Restart Timer" Then
Me.Timer1.Start()
Button2.Text = "Stop Timer"
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If alarmTime < Date.Now Then
Me.Timer1.Stop()
MessageBox.Show("End of the quarter")
Else
Dim remainingTime As TimeSpan = Me.alarmTime.Subtract(Date.Now)
Me.TextBox15.Text = String.Format("{0:d2}:{1:d2}", remainingTime.Minutes, remainingTime.Seconds)
End If
End Sub
Private Sub Start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.alarmTime = Date.Now.AddMinutes(15.02)
Me.Timer1.Enabled = True
Me.Timer1.Start()
End Sub
Private Sub StopRestart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Button2.Text = "Stop Timer" Then
Me.Timer1.Stop()
Button2.Text = "Restart Timer"
ElseIf Button2.Text = "Restart Timer" Then
Me.Timer1.Start()
Button2.Text = "Stop Timer"
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If alarmTime < Date.Now Then
Me.Timer1.Stop()
MessageBox.Show("End of the quarter")
Else
Dim remainingTime As TimeSpan = Me.alarmTime.Subtract(Date.Now)
Me.TextBox15.Text = String.Format("{0:d2}:{1:d2}", remainingTime.Minutes, remainingTime.Seconds)
End If
End Sub