• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 795
  • Last Modified:

Set focus on Sumit button when we press enter after entering text in text box

How do I Set focus on Sumit button when we press enter after entering text in text box
0
SGUDAPAT
Asked:
SGUDAPAT
  • 3
  • 2
  • 2
1 Solution
 
ajit_b10Commented:
This is form level property. I think there is AcceptButton property on the form. You can associate this with one of the buttons so when you press enter, it will actually fire click event of this button.
0
 
SGUDAPATAuthor Commented:
I tried setting the Focus-Enter-Property or event to the submit button, but it didn't work.
Is that is what you were referring if not, can you what exactly it is?
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
Is this ASP.NET or Winforms ?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
ajit_b10Commented:
If you select the form in the design mode, Press F4 to view Form properties, you will find two properties:

1. AcceptButton
Gets/Sets the button on the form that is pressed when the user uses the enter key

2. CancelButton
Indicates the button control that is pressed when the user presses the ESC key

You can associate one of the buttons on the form, to these properties. Once you have associated these properties with respective buttons on the form, the button's event handlers will be invoked automatically when you press ENTER or ESC key.

So in your case assoicate Submit button with AcceptButton property of the form.
0
 
SGUDAPATAuthor Commented:
it is windows form in vb.net
0
 
Jorge PaulinoIT Pro/DeveloperCommented:

In the keydown event for the last textbox you can do something like this:
If e.KeyCode = Keys.Enter Then
   Me.Button1.Select()
End If
0
 
SGUDAPATAuthor Commented:
thanks a bunch
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now