Returns a control object in the form as specified by a given control name or index.
[ pControl = ] Object.Controls( vKey )
The Controls property syntax has the following parts:
|
Name |
Type |
Description |
|
Object |
AForm |
AForm object |
|
vKey |
Val Variant |
A value that identifies a member of a Controls collection. |
|
pControl |
AControl |
The control returned on the AForm object. |
This property is read-only at run time.
If vKey is a number that its used as a zero based index of the control in the form. If string is used than it is the control Name property.
The following statement enables all the controls in the form:
for i=0 to ControlsCount-1
Controls(i).Enable=False
next
The following statements set the caption of a control named "Abort":
Controls("Abort").Caption="Hello"