Solved

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

Posted on 2004-10-06
4
194 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
Comment Utility
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
Comment Utility
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
Comment Utility
How would you do at design time?
0
 
LVL 53

Expert Comment

by:Dhaest
Comment Utility
At design, you can choose "ok" at the option "DialogResult"
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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

762 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

13 Experts available now in Live!

Get 1:1 Help Now