please anyone help me on my problem on timer. I set my timer to 1minute. (60seconds). By clicking the start and pause button runs well but after click another button to resume the time it does not accurate on what time i pause. Example: I start my timer (1minute) and pause to 40seconds. After i resume, the time is not exactly on what my time pause. Instead of 40 seconds it starts in 30 like that depends on what time i click the resume button. It just like it continues in running even i stop the timer. Here is my code.
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
If alarmTime < Date.Now Then
' Display the new time left
' by updating the Time Left label.
Timer2.Stop()
MessageBox.Show("Times Up!.", "Thank you!")
BtnBack.Enabled = True
startButton.Enabled = False
BtnSubmit.Enabled = False
AnsA.Enabled = False
AnsB.Enabled = False
AnsC.Enabled = False
AnsD.Enabled = False
BtnNext.Enabled = False
BtnPrev.Enabled = False
BtnClose.Enabled = True
Categoriess.lnkMathHS.Enabled = False
Else
Dim remainingtime As TimeSpan '= Me.alarmTime.Subtract(Date.Now)
remainingtime = Me.alarmTime.Subtract(Date.Now)
timeLabel.Text = String.Format("{0}:{1:d2}:{2:d2}", _
remainingtime.Hours, _
remainingtime.Minutes, _
remainingtime.Seconds)
End If
End Sub
Private Sub startButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startButton.Click
alarmTime = Date.Now.AddMinutes(TextBox1.Text)
Timer2.Start()
End Sub
Private Sub resumeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles resumeButton.Click
Timer2.start()
End Sub
Private Sub stopButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles stopButton.Click
Timer2.stop()
End Sub