Export (0) Print
Expand All

How to: Designate a Windows Forms Button as the Cancel Button Using the Designer

On any Windows Form, you can designate a Button control to be the cancel button. A cancel button is clicked whenever the user presses the ESC key, regardless of which other control on the form has the focus. Such a button is usually programmed to enable the user to quickly exit an operation without committing to any action.

NoteNote:

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To designate the cancel button

  1. Select the form on which the button resides.

  2. In the Properties window, set the form's CancelButton property to the Button control's name.

Community Additions

Show:
© 2014 Microsoft