"Default" Command Button?

  • Thread starter Thread starter C# Learner
  • Start date Start date
C

C# Learner

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...
 
Set the .AcceptButton property of the form to the button that you want to be
the default
 
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.
 
Back
Top