Enabled Property

See AlsoSBJLJ7                 ExampleB847W>Low

Applies To

Form14TJ2LN, MDI form1ILMZQ7, check box9P3BU5, combo box1YZXFF6, command buttonXJSPC0, data control2E1FEX3, directory list boxO9U5A0, drive list box5WJO0PW, file list box1M6S8UX, frame1KX6ZP8, grid2VGT0PT, horizontal scroll bar1JSJOS7, image9A4FCA, label3MNIZ8D, list boxG11UCK, menuBKDT1F, option buttonJYBO08, picture box31MYIWX, text boxYPYZDG, timer3MVR08J, vertical scroll bar1JSJOS7.

Description

Determines whether the form or control can respond to user-generated events.

Usage

[form.][control.]Enabled[ = boolean ]

Setting

The Enabled property settings are:

Setting     Description

 

True         (Default) Allows the object to respond to events.

False        Prevents the object from responding to events.

 

Remarks

This property allows forms and controls to be enabled or disabled at run time.  For example, you can disable objects that don't apply to the current state of the application.  You can also disable a control used purely for display purposes, such as a text box that provides read-only information.

Disabling a timer by setting Enabled to False suspends the countdown set up by the control's Interval3LX7YRY property.

Data Type

IntegerDOKXHY (Boolean)


See Also

Help:

Interval Property3LX7YRY

Visible Property32KNZA4

 

Programmer's Guide:

Chapter 3, "Creating and Using Controls"


Enabled Property Example

The example enables a command button whenever the text box contains text.  To try this example, paste the code into the Declarations section of a form.  Then press F5 and type something into the text box.

Sub Form_Load ()
  Text1.Text = ""            ' Clear the text box.
  Command1.Caption = "Save"  ' Put caption on button.
End Sub

Sub Text1_Change ()
  If Text1.Text = "" Then    ' See if textbox is empty.
    Command1.Enabled = False ' Disable button.
  Else
    Command1.Enabled = True  ' Enable button.
  End If
End Sub