forms

forms(formNumber: Integer): Form;

The forms method of the Application class enables logic to access running forms in the application. This method returns a reference to the form at the number specified in the formNumber parameter, or null if the form number is invalid. This method returns an object of type Form, which enables the properties of the form to be accessed. The default MDI parent frame is not included in the list of returned forms.

To access a specific form control, you must convert the object to a form of the appropriate type, as shown in the following example that examines all active forms for the application and accesses the text1 control of the menu form.

vars
    form : Form;
    indx : Integer;
begin
    foreach indx in 1 to app.formsCount do
        form := app.forms(indx);
        if form.name = "Menu" then
            form.Menu.text1.text := "The text for text box text1";
        endif;
    endforeach;
end;

You should not write logic like that shown in this example to cycle through forms in the range 1 through the value of app.formsCount when the logic involves the unloading of forms. (Unloading a form causes the formsCount property to change and the table of forms to be compressed.)