Solved

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

Posted on 2008-10-07
7
777 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
Comment Utility
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
Comment Utility
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
Comment Utility
Is this ASP.NET or Winforms ?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Expert Comment

by:ajit_b10
Comment Utility
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
Comment Utility
it is windows form in vb.net
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 125 total points
Comment Utility

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
Comment Utility
thanks a bunch
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video discusses moving either the default database or any database to a new volume.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 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

14 Experts available now in Live!

Get 1:1 Help Now