By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,759 Members | 1,778 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,759 IT Pros & Developers. It's quick & easy.

"Default" Command Button?

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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.com...
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

P: n/a
"William Ryan eMVP" <do********@comcast.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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.