JB28
JB28

Reputation: 57

VB setFocus after Typing in Textbox without losing it

I have a login screen where I set the focus to be on the password textbox so that the user can start typing their password without clicking anything.

I want to set the focus to the login button as soon as a character is typed into the password textbox so that the user can just hit Enter when they're done typing in the password.

I don't want to lose focus on the password textbox, but I want the login button to be highlighted so that you can hit Enter.

Right now I have to hit Tab, then Enter for this to work.

Upvotes: 0

Views: 367

Answers (2)

JB28
JB28

Reputation: 57

Figured it out. Went to the Property Sheet for the Login button and the Default property was set to No. Changed it to Yes and it works perfectly. Thanks.

Upvotes: 0

Idle_Mind
Idle_Mind

Reputation: 39152

Set the Form.Accept Property of your Form to the Button's Name:

Gets or sets the button on the form that is clicked when the user presses the ENTER key.

Then when the user is done entering their password and hits enter your button will be clicked automatically for them.

Upvotes: 2

Related Questions