Solved

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

Posted on 2004-10-06
4
198 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Footer for each row on Gridview 2 41
VB.NET 2008 Winforms Signing 13 42
Help with opening combobox using VB.NET. 3 38
VB.NET String Settings and Temp Folder Question 3 73
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 …
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…

726 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