DefaultCancel Property

       

Returns or sets a value determining if a control can act as a standard command button. The DefaultCancel property is read/write at the control’s authoring time, and not available at the control’s run time.

Settings

The settings for DefaultCancel are:

Setting Description
True The control can act as a default or cancel command button. The container will add the Default and Cancel properties to the extender object. The presence of the Default and Cancel properties allow the control to act as a standard command button. The control can then set these added extender properties.
False (Default) The control cannot act as a default or cancel command button. No constituent control can have its Default or Cancel property set to True.

Remarks

Setting the Default property to True and also having a constituent control with its Default property set to True will cause the constituent control to be pressed when the ENTER key is pressed, otherwise the control’s AccessKeyPress event will be raised when the ENTER key is pressed.

Setting the Cancel property to True and also having a constituent control with its Cancel property set to True will cause the constituent control to be pressed when the ESCAPE key is pressed, otherwise the control’s AccessKeyPress event will be raised when the ESCAPE key is pressed.

Important   The status of a default or cancel button can change at any time. Code must be placed in the control’s AmbientChanged event procedure to detect changes in the DisplayAsDefault property, and the control’s appearance adjusted accordingly.