Select the product you need help with
How To Make ENTER Key Move Focus Like TAB Key for VB ControlsArticle ID: 142816 - View products that this article applies to. This article was previously published under Q142816 On This PageSUMMARY
You can cause the ENTER key to move the focus to the control with the
next higher TabIndex property value, as the TAB key does.
However, using the ENTER key to move the focus does not follow recommended Microsoft Windows-based application design guidelines. The ENTER key should be used to process the default command or to process entered information, not to move the focus. MORE INFORMATION
You can detect when the user presses the ENTER key from the KeyPress event
procedure by checking to see if the KeyAscii parameter is the character
code for the ENTER key (13). Then you can move the focus to the next
control in the TabIndex order with SendKeys "{tab}." You can move the focus
to the previous control with SendKeys "+{tab}."
This technique works with most kinds of controls. It does not work with command button controls, because command buttons do not receive the KeyPress event when you press the ENTER key. Step-by-Step Example
PropertiesArticle ID: 142816 - Last Review: July 1, 2004 - Revision: 2.1 APPLIES TO
| Article Translations
|


Back to the top








