Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to invoke code by hitting "enter key"?

Status
Not open for further replies.

rxsims

Technical User
Jul 14, 2003
34
CA
I want to tab through controls, and when on a control (already tabbed there, and it has gotFocus), I want to hit "enter key" and invoke code.

When I use the "On Enter" event, when I tab to a control, it runs the code automatically. I believe that is because "On Enter" actually runs before the "gotFocus".

I thought the "on click" event was supposed to act this way but it doesn't. When I hit enter on a control, the cursor moves the same way the tab does.

Some other threads have the opposite problem (they want the "enter" key to work the same as "tab") but I couldn't find the answer to my problem.
 
You may use the KeyPress event procedure of the control.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top