Avoid Tab

Posted on 2003-03-27
Medium Priority
Last Modified: 2010-05-01
Dear All,

I have two textboxes and one command button in a window. Textboxes are for to enter the login name & password. Command button I am using to allow the user to go into next screen if name & password is valid.
Is it possible to press "Enter" and move to next screen just after entering password? To avoid clicking the Command button.

Thnx & rgds

Question by:maan1970
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Accepted Solution

Metalhead earned 80 total points
ID: 8219144
Yes in the KeyPress event of your textbox you can capture the keypressed and do whatever you want

Here's a sample code of what you might put in there, this checks if an Enter has been pressed and then executes your command button's Click event

    If KeyAscii = 13 Then
        KeyAscii = 0
    End If
LVL 44

Expert Comment

ID: 8219253
or, set the Default property of the Command Button to True.

One button can be set as the DEFAULT (Default=True), and when the Enter key is pressed, THAT button's click event is fired.


Expert Comment

ID: 8262915
I go with Arthur_Wood Using "Default=True" is the ultimate.

Also you can use "Cancel=True" for "Close" or "Cancel" Button if the user wanna close the window by pressing "Esc" Key.

Expert Comment

ID: 8262919
I go with Arthur_Wood Using "Default=True" is the ultimate.

Also you can use "Cancel=True" for "Close" or "Cancel" Button if the user wanna close the window by pressing "Esc" Key.


Expert Comment

ID: 8262988

  The Default=true is good if you want that button to be clicked on any Enter.
  But what I think he wants and probably is more logical, is if you are in the username textbox and press enter you go to the password textbox and then when you press enter you execute the OK button.


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month12 days, 17 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question