.netvb.netvisual-studio-2012dispatchertimer

Make Timer interval less than 1 ms .Net


I'm trying to make Timer with an Interval less than 1 Ms.

My Attempt:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Timer1.Interval = 0000001
    Timer1.Start()
End Sub

  Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
    ProgressBar1.Increment(+1)
    If ProgressBar1.Value = 100 Then
        Timer1.Stop()
        ProgressBar1.Value = 0
        MessageBox.Show("Done, 1 Ms")
    End If
End Sub

When i utilize a "0000001" interval, the interval value returned "1".

My main purpose is to make a timer run as Nanoseconds to increase a label's text (+1) faster than 1 ms. I know it will make (+1000) for every 1 second, but I need make it faster than 1 ms.

So, is it possible that the timer can be faster than 1ms?


Solution

  • Unfortunately, this is not possible. See this msdn post for more reading on this issue. The StopWatch object could be use for measuring accurately, but there is no tick event that we see with the Timer.