Description

A collection of child controls contained in a specified control.

Remarks

Use the Controls property to return a reference to the ControlCollection.

Each control in the ControlCollection of an object has a unique index whose value can be either an integer or a string. The index value for the first control in the collection is 0; the value for the second control is 1, and so on. This value indicates the order in which controls were added to the collection.

If the index is a string, it represents the name of the control. The Name property of a control also specifies a control's name. You can use the ControlCollection to enumerate or count individual controls, and to set their properties. For example, you can enumerate the ControlCollection of a particular form and set the Height property of each control to a specified value.

Examples

The following example creates a new button and adds it to a form.

$Button = $Form.Controls.Add("Button")

The following example returns a control by index number.

$Form.Controls(0).Text = "Click Me!"

The following example returns a control by name.

$Form.Controls("Button1").Text = "Click Me!"




The CHM file was converted to HTML by chm2web software.