Originally posted by wossname
Timespan.Ticks, take a look.
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???????

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:
  1. Dim ZeroTime, EndTime, RunTime, TimeLeft As Double
  2.    Dim sTime As String
  3.    Dim bTimer As Boolean = False  
  4.  
  5.  Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  6.  
  7.         ZeroTime = 0
  8.         EndTime = 0
  9.         Timer1.Enabled = True
  10.         Timer1.Interval = 1
  11.         sTime = ""
  12.  End Sub
  13.  
  14.  Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  15.         If bTimer = False Then
  16.             EndTime += 0.1
  17.             TimeLeft = EndTime + 0.001
  18.             If TimeLeft >= 1 Then
  19.                 sTime = CStr(Int(TimeLeft))  ' display 100'ths second
  20.                 RunTime = TimeLeft Mod 100
  21.                 TimeLeft = Int(TimeLeft / 100)
  22.                 sTime = CStr(RunTime) & ":" & sTime
  23.                 RunTime = TimeLeft Mod 60
  24.                 TimeLeft = Int(TimeLeft / 60)
  25.                 sTime = CStr(RunTime) & ":" & sTime
  26.                 RunTime = TimeLeft Mod 60
  27.                 TimeLeft = Int(TimeLeft / 60)
  28.                 sTime = CStr(RunTime) & ":" & sTime
  29.                 TextBox3.Text = sTime & CStr(Int(TimeLeft))
  30.             End If
  31.  
  32.         End If
  33. End Sub