Oct 28, 2011

How to set default Cancle button of Windows form?

There is a property of form is CancelButton,
If this property is set, the button is 'clicked' whenever the user pressed the 'ESC' Key.
You just set the name of that close button which you want to fire default when you press 'ESC' Key.

Example:-
Form1.CancelButton = btnClose;
You can also set it by property window of form.

No comments: