473,763 Members | 1,395 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"Default" Command Button?

Is it possible to set a command button to the "default" button of the
form?

Here's an example of what I mean -- press Start -> Run. Notice that
the "OK" button has a dark rectangle around it, and when you press
ENTER, this "OK" button's Click event handler is eventually fired.

I was expecting Button to have a Default property, but can't seem to
find anything like it...
Nov 15 '05 #1
3 5574
Set the .AcceptButton property of the form to the button that you want to be
the default
"C# Learner" <cs****@learner .here> wrote in message
news:3n******** *************** *********@4ax.c om...
Is it possible to set a command button to the "default" button of the
form?

Here's an example of what I mean -- press Start -> Run. Notice that
the "OK" button has a dark rectangle around it, and when you press
ENTER, this "OK" button's Click event handler is eventually fired.

I was expecting Button to have a Default property, but can't seem to
find anything like it...

Nov 15 '05 #2
"William Ryan eMVP" <do********@com cast.nospam.net > wrote:
Set the .AcceptButton property of the form to the button that you want to be
the default


Ah, thanks!
Nov 15 '05 #3
Hello, C#!

There is another property of the FORM called CancelButton
which does the same thing, but when you hit ESC
You know, if you click Start->Run and the hit ESC on keyboard,
the dialogbox just disappears...
Buttons also have a property called DialogResult
If you have ever used any DialogBox (and its outcoming result),
like OpenFileDialog or SaveFileDialog. ..
You can do the same thing...
If you need a piece of code to demo that, please let me know,
I will be more than happy to help you.

You wrote on Thu, 05 Feb 2004 18:12:34 +0000:

CL> Here's an example of what I mean -- press Start -> Run. Notice that
CL> the "OK" button has a dark rectangle around it, and when you press
CL> ENTER, this "OK" button's Click event handler is eventually fired.
With best regards, Nurchi BECHED.
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3626
by: AA Arens | last post by:
When I place a record serch utility (vos the button placement wizzrd), I discovered that the Match setting is "Whole Field" by default. How to make "Any Part Of Field" default?
2
7978
by: Paul Brady | last post by:
I have non-computer skilled users entering data into a form. There are certain ranges of values which, if they enter them, make no sense in the application, but I can't test them until they try to close out the form, in which case I can look at the entire set of values and see if they're OK. So, I have this code. for the "Before Update" event: if (their variables are inappropriate) then msgbox "You've entered bad variables (or some...
18
2254
by: Clark Nu | last post by:
It seems that when I define a fuction,I can set a default value to some of the peremeters.When I call the fuction without some of them,the fuction will use the default value automaticlly then continue to work.But I'v fogot how to use,even I'v fogot whether I can use it in C# or not. Help me.
6
8226
by: Paul Turley | last post by:
Does anyone have some sample script to "press" a button or image button when the user presses the Enter key? I see this behavior on a lot of web pages but I'm not finding any samples. Thx -- Paul Turley, MCSD, MCAD, MCT, MSF Practitioner, A+ Technician paul@createsolutions.net
3
2363
by: Jensen bredal | last post by:
Hello, I have an html submit button wich i have converted into a server control(ascx) . I want it serverside click event to be fired on "enter". How can this be achieved? Many thanks in advance JB
2
1336
by: Agnes | last post by:
Once form _Load, i want to set the caplocks on . How can I do that ?? Or I want to set it When the user press "New" button in my program, I want to Caplocks on . Thanks a lot. I try (1)System.Windows.Forms.SendKeys.Send(System.Windows.Forms.Keys.CapsLock) (2)sendKeys.Send("{CAPLOCKS}") BUT IT DOESN'T WORK
15
12547
by: simonoficina | last post by:
Hello all! I am a vb.net beginner in Spain. When I use VB6 ,the button object has a property called "default" that can set this button like press "ENTER" key. But in the VB.net I can't find this property. Where is it? Or mabye change the other thing,No?Thanks ! Simon
1
1702
by: test | last post by:
Using a DetailsView to update data in SQL 2005, How do I change the default "Update" hyperlink to a more user friendly button? Thanks
10
10806
Shakss2
by: Shakss2 | last post by:
I have a form, where I can activate the search and replace dialogbox when pressing a button. My problem is that the dialogbox opens with the default that it should search for full match only, and I want it to open with default "a part of field". I did change it to default "A part of the field"? by going to Tools -> Options menu to open the "Options" dialog window. Select the "Edit/Find" tab. Select the "General Search" option button.
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10145
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.