See Also Example
Applies To
Form, MDI form
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 Interval
Data Type
Integer (Boolean)
Help:
Interval Property
Visible Property
Programmer's Guide:
Chapter 3, "Creating and Using Controls"
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