title: TIMER or STOPWATCH in visual basic 2010
body: <p>I have  little dummy software to test the precision of the stopwatch in visual basic. I've been told that visual basic has a real good timing, but I'm experiencing some strange behaviors.</p>
  
  <p>This is ALL my code:</p>
  
  <pre><code>Imports System.IO
  Public Class Form1
      Public tmrTime As New Stopwatch
      Dim currentDate As Date
  
      Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
          tmrTime.Start()
  
      End Sub
  
      Private Sub Form1_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
          TextBox1.Text = (tmrTime.ElapsedTicks / Stopwatch.Frequency) * 1000
  
      End Sub
  
  
      Private Sub Form1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
  
          TextBox2.Text = (tmrTime.ElapsedTicks / Stopwatch.Frequency) * 1000
      End Sub
  End Class
  </code></pre>
  
  <p>The problem si that if I take the non-decimal part of the two textbox (which is the absolute time of pressing and the abs. time of releasing) they are almost ALWAYS coupled, that is BOTH ODD or BOTH EVEN.</p>
  
  <p>Do you know what's happening?  </p>
  
  <p>I have the same result using tmrTime.ElapsedMilliseconds or tmrTime.Elapsed.Ticks :-\</p>