Enabled Property

                          

Specifies whether a control can receive the focus and respond to user-generated events.

Syntax

object.Enabled [= Boolean]

The Enabled property syntax has these parts:

Part Description
object Required. A valid object.
Boolean Optional. Whether the object can respond to user-generated events.

Settings

The settings for Boolean are:

Value Description
True The control can receive the focus and respond to user-generated events, and is accessible through code (default).
False The user cannot interact with the control by using the mouse, keystrokes, accelerators, or hotkeys. The control is generally still accessible through code.

Remarks

Use the Enabled property to enable and disable controls. A disabled control appears dimmed, while an enabled control does not. Also, if a control displays a bitmap, the bitmap is dimmed whenever the control is dimmed. If Enabled is False for an Image, the control does not initiate events but does not appear dimmed.

The Enabled and Locked properties work together to achieve the following effects:

You can combine the settings of the Enabled and the TabStop properties to prevent the user from selecting a command button with TAB, while still allowing the user to click the button. Setting TabStop to False means that the command button won't appear in the tab order. However, if Enabled is True, then the user can still click the command button, as long as TakeFocusOnClick is set to True.

When the user tabs into an enabled MultiPage or TabStrip, the first page or tab in the control receives the focus. If the first page or tab of a MultiPage or TabStrip is disabled, the first enabled page or tab of that control receives the focus. If all pages or tabs of a MultiPage or TabStrip are disabled, the control is disabled and cannot receive the focus.

If a Frame is disabled, all controls it contains are disabled.

Clicking a disabled ListBox does not initiate the Click event.