Solved

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

Posted on 2008-10-07
7
782 Views
Last Modified: 2012-05-05
How do I Set focus on Sumit button when we press enter after entering text in text box
0
Comment
Question by:SGUDAPAT
[X]
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
  • 3
  • 2
  • 2
7 Comments
 

Expert Comment

by:ajit_b10
ID: 22659213
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
 
LVL 1

Author Comment

by:SGUDAPAT
ID: 22659274
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
 
LVL 48

Expert Comment

by:jpaulino
ID: 22659356
Is this ASP.NET or Winforms ?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:ajit_b10
ID: 22659384
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
 
LVL 1

Author Comment

by:SGUDAPAT
ID: 22659399
it is windows form in vb.net
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 125 total points
ID: 22659541

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
 
LVL 1

Author Closing Comment

by:SGUDAPAT
ID: 31503831
thanks a bunch
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access Schema 6 53
VB.Net Data Class 1 44
Read top line from CSV file 14 57
VB.NET Parsing UDP Bytes 15 32
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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