The
Environment.TickCount
gives you the number of milliseconds that have elapsed since the system was started the number will cycle from lowest to highest value every 49.8 days so to use it.
Dim startTickCount As Int32 = Environment.TickCount
'Do something here
Dim endTickCount As Int32 = Environment.TickCount
Once you have these two values you could use the following function to determine the number of milliseconds elapsed.
Public Function ElapsedMilliseconds(ByVal StartTickCount As Int32, ByVal EndTickCount As Int32) As Int32
Dim elapsedTime As Int32 = 0
If StartTickCount > EndTickCount Then
elapsedTime = (Int32.MaxValue - StartTickCount) + (EndTickCount - Int32.MinValue)
Else
elapsedTime = EndTickCount - StartTickCount
End If
Return elapsedTime
End Function