Solved

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

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

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

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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…
A short film showing how OnPage and Connectwise integration works.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

914 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

19 Experts available now in Live!

Get 1:1 Help Now