I am initiating the Hours, Minutes and Seconds
And then Converting it to total milliseconds.
And then what i am doing is subtracting the Total MilliSeconds from Elapsed MilliSeconds
i.e elms = cms - e.Milliseconds
(Evaluated Milliseconds = calculated Millisec. - Stopwatch.elapsedMilliseconds)
and then converting the Evaluated Milliseconds back to the HH:MM:SS:MS format.
but its not working due to some logical error, Thats why i need some assistance. please help me a little Here's My Code:
Dim dd As Integer = 0
Dim mm As Integer = 0
Dim hh As Integer = 0
Dim ss As Integer = 0
Dim ms As Integer = 0
Dim cms As Long = 0
Dim elms As Long = 0
Dim stopwatch As System.Diagnostics.Stopwatch = New System.Diagnostics.Stopwatch
Dim dt As DispatcherTimer = New DispatcherTimer
Private Sub StartButton_Click(sender As Object, e As RoutedEventArgs) Handles StartButton.Click
hh = Hours.Text * 60 * 60 * 1000
mm = Minutes.Text * 60 * 1000
ss = Seconds.Text * 1000
cms = hh + mm + ss
hh = mm = ss = 0
Start()
End Sub
Private Sub Start()
dt.Interval = New TimeSpan(0, 0, 0, 0, 10)
AddHandler dt.Tick, AddressOf ontimertick
stopwatch.Start()
dt.Start()
End If
End Sub
Private Sub ontimertick()
Dim e As New TimeSpan
e = stopwatch.Elapsed
elms = cms - e.Milliseconds
ss = ((elms Mod (1000 * 60 * 60)) Mod (1000 * 60)) \ 1000
mm = (elms Mod (1000 * 60 * 60)) \ (1000 * 60)
hh = elms \ (1000 * 60 * 60)
elms = elms Mod 1000
MicroSeconds.Text = elms.ToString("00")
Seconds.Text = ss.ToString("00")
Minutes.Text = mm.ToString("00")
Hours.Text = hh.ToString("00")
End Sub