Share via


Default Property

Specifies which command button or OLE Container control responds to the ENTER key being pressed when there are two or more command buttons on an active form. Available at design time and run time.

Object.Default[ = lExpr]

Property Values

  • lExpr
    The settings for the Default property are:
    Setting Description
    True (.T.) When the button's Default property is set to true (.T.) and its parent form is active, the user can execute the button's command by pressing ENTER. (If the focus is in an edit box, the user can press CTRL+ENTER.)If KEYCOMP is set to WINDOWS, the default button's command is not executed if the focus has been moved to another command button. In that case, pressing ENTER affects the button with the focus instead of the default button.
    False (.F.) (Default) The button is not the default button.

Remarks

The Default property only applies to an OLE Container control that contains an "Acts like a Button" ActiveX control (.ocx).

Only one command button or OLE Container control on a form can be the default command button. When the Default property is set to true (.T.) for one command button or OLE Container control, it is automatically set to false (.F.) for all other command buttons or OLE Container controls on the form. You cannot create a default command button or OLE Container control in a toolbar.

See Also

Enabled Property | KeyPress Event

Applies To: CommandButton | OLE Container Control