How do I use an accelerator in a label to have the focus move to the textbox or control associated with that label?
Label controls, although they support the ampersand accelerator and tabindex/tabstop, never actually receive focus. When a label is activated by the mnemonic key, control moves to the control having the next higher tabindex. So, by setting the tabindex of a textbox (or control) that you want to gain focus when the label mnemonic is pressed to 1 more than tabindex of the label, focus will move to that control when the accelerator key is pressed.
Related Questions
- How do I have a Delete key shortcut on a forms main menu, and still process the Delete key in a TextBox when that control has the focus?
- How can I make the focus move to the next control when the user presses the Enter key in a TextBox?
- How do I make the focus move to the next control when the user presses the Enter key in a TextBox?