Solved

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

Posted on 2008-10-07
7
778 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now