using keyboard input to move picture box
Posted on 2006-11-10
I am trying to write code to move a picture box by pressing the left, right, up or down arrows .
I have tried the following code:
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
Label1.Text = e.KeyChar
If e.KeyChar = "a" Then
pb1.Left = 100
This works if I use "A" on the keyboard or program it for any other letter but does not work for up, down, left and right arrows. There does not seem to be a value in e.keyChar. What would be the easiest code to move the picture box using these keys?