gr8life
asked on
Stop Watch Question
I am using the below code as a stopwatch. Is it possible to adapt the code to be more accurate? Currently it displays results as: hours, minutes, and seconds. I need to also display smaller increments such as tenths of a second. So the desired result includes the original result as well as the tenths of a second as well.
Thank you for your time,
Gr8life
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button1.Enabled = False
Dim startDT As DateTime = DateTime.Now
Dim stopDT As DateTime = DateTime.Now
Dim elapsedTS As TimeSpan = stopDT.Subtract(startDT)
Dim msg As String = elapsedTS.Hours & "h" & elapsedTS.Minutes & "m" & elapsedTS.Seconds & "s"
MessageBox.Show("Process duration: " & msg)
Button1.Enabled = True
End Sub
Thank you for your time,
Gr8life
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button1.Enabled = False
Dim startDT As DateTime = DateTime.Now
Dim stopDT As DateTime = DateTime.Now
Dim elapsedTS As TimeSpan = stopDT.Subtract(startDT)
Dim msg As String = elapsedTS.Hours & "h" & elapsedTS.Minutes & "m" & elapsedTS.Seconds & "s"
MessageBox.Show("Process duration: " & msg)
Button1.Enabled = True
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
TVoteyDisciple your answer is close enough.
Fernando, thank you for your response, but unfortunately I still have 2003. Hopefully someone will read this post and be able to use your valuable code.
thanks everyone,
Gr8life