controls(controlNumber: Integer): Control;
The controls method of the Form class enables logic to access the controls on an active form at run time. This method returns a reference to the active control object specified in the controlNumber parameter or null if there is no specified control.
The method returns an object of type Control, which enables the properties of a control to be accessed.
To access a property specific to a type of control, the object must be converted to a control of the appropriate type, as shown in the following example that examines all controls on a form.
vars cntrl : Control; indx : Integer; textBox1 : TextBox; begin foreach indx in 1 to controlCount do cntrl := controls(indx); if cntrl.isKindOf(TextBox) then textBox1 := cntrl.TextBox; if textBox1.maxLength > 60 then ... endif; endif; endforeach; end;