Sorry, my brain seems to have gone numb. The MSDN article does not say how to use it in formatting. Also, am I reading it right when it says a Tick is one ten-millionth of a second???????Originally posted by wossname
Timespan.Ticks, take a look.
I did look at timespan before and rejected it for minute period counting purposes but if you know different please advise.
I have incorporated your recommendation to use shorter intervals for the timer for greater accuracy -- thanks.
Private 1337.
So far I have the following code. It does the calculations OK but I am having problem with the display. It does not recognise the minutes break at 60 seconds etc. See what you can do with it.
VB Code:
Dim ZeroTime, EndTime, RunTime, TimeLeft As Double Dim sTime As String Dim bTimer As Boolean = False Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click ZeroTime = 0 EndTime = 0 Timer1.Enabled = True Timer1.Interval = 1 sTime = "" End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If bTimer = False Then EndTime += 0.1 TimeLeft = EndTime + 0.001 If TimeLeft >= 1 Then sTime = CStr(Int(TimeLeft)) ' display 100'ths second RunTime = TimeLeft Mod 100 TimeLeft = Int(TimeLeft / 100) sTime = CStr(RunTime) & ":" & sTime RunTime = TimeLeft Mod 60 TimeLeft = Int(TimeLeft / 60) sTime = CStr(RunTime) & ":" & sTime RunTime = TimeLeft Mod 60 TimeLeft = Int(TimeLeft / 60) sTime = CStr(RunTime) & ":" & sTime TextBox3.Text = sTime & CStr(Int(TimeLeft)) End If End If End Sub




Reply With Quote