I have recently started working on VB.net with a small bakground of c++
I wanted to know what is the smallest interval that we can have for timer...i've tried the following code with smallest interval of 1 meaning 1 millisec but the timer doesnt increments in a milisec...it is slower...although if i write 1000 (meaning increment after every sec) in the interval then it rightly increments....
can anybody explain me this?

Public Class Form1

    Dim i As Integer
    Dim value1 As String
    Dim timeinterval As TimeSpan

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        i += 1
        Button1.Text = Convert.ToString(i)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
               i = 0
              Timer1.Interval = 1 : Timer1.Start()
    End Sub
End Class
9 Years
Discussion Span
Last Post by ericstenson

i am willing to bet the computer cannot respond fast enough. that is why you are seeing it work OK with 1 second (more than enough time for the computer to process & update), but not work for 1 ms (not enough time to go through the code, process, and update). try something a little larger.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.