Stopwatch

jlehto22

New member
Joined
Mar 23, 2007
Messages
1
Programming Experience
Beginner
Hi,

I have modified some stopwatch for my purposes, now I have a problem,
it works fine, but I need a control to change seconds up or down step by step when stopwatch is paused ?



VB.NET:
Private Sub buttonStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonStart.Click
If sw.IsRunning Then
sw.Stop()
buttonStart.Text = "Start"
 
Dim ts As TimeSpan = TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds)
labelTime.Text = String.Format(CultureInfo.CurrentCulture, "{0:00}:{1:00}", ts.Minutes, ts.Seconds)
 
labelLapPrompt.Visible = True
 
 
' If paused Then
labelLap.Text = labelTime.Text
labelLapPrompt.Text = "Last stop"
paused = False
'End If
 
Else
sw.Start()
buttonStart.Text = "Stop"
 
labelLap.Visible = True
labelLapPrompt.Visible = True
End If
End Sub
 
Private Sub timerMain_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timerMain.Tick
If sw.IsRunning Then
Dim ts As TimeSpan = TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds)
labelTime.Text = String.Format(CultureInfo.CurrentCulture, "{0:00}:{1:00}", ts.Minutes, ts.Seconds)
 
If paused Then
labelLap.Text = labelTime.Text
labelLapPrompt.Text = "Last stop"
paused = False
End If
End If
End Sub
- jyrki -
 
Last edited by a moderator:
Back
Top