I'm using the following code I found here in another thread, to enable the arrow keys on my keyboard to move a rectangle around in a picture box instead of cycling through the controls on the form. This works, but I have a question if I'm doing this right. I have four buttons on the form. Do I have to place this in every button? and do I have to place it in every control I add? or is there a simpler way to do this.
Code:
Private Sub btnR_PreviewKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles btnR.PreviewKeyDown
Select Case e.KeyCode
Case Keys.Up, Keys.Right, Keys.Down, Keys.Left
e.IsInputKey = True
End Select
End Sub