Reputation: 63
i have panel. dynamically i have created more than 10 buttons. the panel contains that all buttons. i want to select the any buttons using arrow up/Down/Left/Right? please give some idea's.enter image description here
Upvotes: 0
Views: 963
Reputation: 1731
you can hookup the KeyDown Event
of the button like this:
Public Sub DesignPane_KeyDown(sender As Object, e As KeyEventArgs)
If e.KeyCode = Keys.Down Then
txtBox.Location.Y += 1
ElseIf e.KeyCode = Keys.Right Then
txtBox.Location.X += 1
ElseIf e.KeyCode = Keys.Up Then
txtBox.Location.Y -= 1
ElseIf e.KeyCode = Keys.Left Then
txtBox.Location.X -= 1
End If
End Sub
Upvotes: 1