repeat delay in Keydown event

Is there any way to keep the keydown event from having a repeat delay when the key is held

I know you can go into Control Panel and adjust the keyboard settings, but is there a way to get around that in VB

In case it is useful, my code is:

Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown

Select Case e.KeyCode

Case Keys.Left

The_moving_object.Left -= 20

Case Keys.Right

The_moving_object.Left += 20

Case Keys.Up

The_moving_object.Top -= 20

Case Keys.Down

The_moving_object.Top += 20

End Select

End Sub



Answer this question

repeat delay in Keydown event

  • Martin Crimes

     

    Well there's a simple way...

    .

    .

    .

    The_moving_object.Top -= 20

    Case Keys.Down

    The_moving_object.Top += 20

    End Select

    system.threading.threads.sleep( n number of milliseconds)

    End Sub



  • DSRC

    That makes a delay in between each keydown event. What I want to do is remove the delay before the computer registers a repeated keydown while the button is held down.
  • repeat delay in Keydown event