Solved

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

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb.net help 4 31
How to open form using item in Listbox. 8 21
VB.NET 2008 - SQL Timeout 9 25
How to seperate number and letters from a string 3 11
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

831 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