Solved

Making a button on a form the default button (enter key  on the keyboard)

Posted on 2004-10-06
4
200 Views
Last Modified: 2010-04-23
In VB.net there is no place I found on the properties window declare a button as the default button like in VB6.0( same as the enter button on the keyboard)

I tried this, Is this the right place (Form Load) for this code? it seems to work okay

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
               Me.AcceptButton = Button1 'enter button
        Me.CancelButton = Button3        'exit button


    End Sub
0
Comment
Question by:ucla11
[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
4 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 12235227
On your form, set the AcceptButton property to the name of your default button.
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 50 total points
ID: 12235233
So your approach was correct. You can either do it in code like you did it, or just do it at design time
0
 

Author Comment

by:ucla11
ID: 12235237
How would you do at design time?
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 12235270
At design, you can choose "ok" at the option "DialogResult"
0

Featured Post

Industry Leaders: 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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

728 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