Moving PictureBox Through Keystrokes
hey guys,
I have a picture box that i want to move via the arrow keys, and when its pressed and/or held down it will move
here is my current code :
Private Sub PictureBox18_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Up Then
PictureBox18.Top -= 10
ElseIf e.KeyCode = Keys.Down Then
PictureBox18.Top += 10
ElseIf e.KeyCode = Keys.Left Then
PictureBox18.Left -= 10
ElseIf e.KeyCode = Keys.Right Then
PictureBox18.Left += 10
End If
End Sub
Would appreciate some help, and i apologies if its a noob question
I have a picture box that i want to move via the arrow keys, and when its pressed and/or held down it will move
here is my current code :
Private Sub PictureBox18_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Up Then
PictureBox18.Top -= 10
ElseIf e.KeyCode = Keys.Down Then
PictureBox18.Top += 10
ElseIf e.KeyCode = Keys.Left Then
PictureBox18.Left -= 10
ElseIf e.KeyCode = Keys.Right Then
PictureBox18.Left += 10
End If
End Sub
Would appreciate some help, and i apologies if its a noob question