1
votes

Assume you have a form with ten buttons on it with the first one having the keyboard focus so that it can be clicked by hitting the Enter key on the keyboard. Now, you can set the focus to the next button simply by pressing the Down arrow key. This works out of the box.

Question:
How can I constrain this functionality to the first three buttons on the form?
So, when the third button on the form has the focus and I press the Down arrow key, the first button - instead of the forth button - should receive the focus.

1
Sounds like you'd need to handle the KeyUp/KeyDown events and add the logic yourself.Anthony
yes, as Anthony says - and you should be able to put them in a 'group' of some kind, if visual C# gui handling is anything like visual basic.Plasmarob

1 Answers

4
votes

Put them in a container.

That way - it will only iterate through those buttons. (I just tried with a Panel and it works.)