Share via


DO FORM Command

Runs a compiled form or form set created with the Form designer.

DO FORM FormName | ? [NAME VarName [LINKED]] [WITH cParameterList]
   [TO VarName] [NOREAD] [NOSHOW]

Parameters

  • FormName
    Specifies the name of the form or form set to run.

  • ?
    Displays the Do dialog box from which you can choose a form or form set to run.

  • NAME VarName [LINKED]
    Specifies a variable or array element with which you can reference the form or form set. If you specify a variable that doesn't exist, Microsoft Visual FoxPro automatically creates it. If you specify an array element, the array must exist before you issue DO FORM. If the variable or array element you specify already exists, its contents are overwritten.

    If you omit the NAME clause, Visual FoxPro creates an object type variable with the same name as the form or form set file.

    Include LINKED to link the form to the variable associated with it so that the form is released when the variable goes out of scope. If you don't include LINKED, a form can still be active, even though there is no object variable associated with the form.

  • WITH cParameterList
    Specifies the parameters passed to the form or form set.

    If a form set is run, the parameters are passed to the form set's Init method if the form set's WindowType property is set to ModeLess (0) or Modal (1). The parameters are passed to the Load method if the form set's WindowType property is set to Read (2) or ReadModal (3).

  • TO VarName
    Specifies a variable to hold a value returned from the form. If the variable doesn't exist, Visual FoxPro automatically creates it. Use the RETURN command in the Unload event procedure of the form to specify the return value. If you do not include a return value, the default value of true (.T.) is returned. If you use TO, the WindowType property of the form must be set to 1 (Modal). If the form Init event procedure returns .F., preventing the form from being instantiated, the Unload event procedure will not return a value to VarName.

  • NOREAD
    Specifies that the form set is created and displayed, even though controls are not activated until READ is issued. NOREAD is ignored if the form set object's WindowType property is not set to 2 (Read).

  • NOSHOW
    Specifies that the form's Show method isn't called when the form is run. When you include NOSHOW and run the form, the form is not visible until the form's Visible property is set to true (.T.) or the form's Show method is called.

Remarks

DO FORM executes the Show method for the form or form set.

The WindowType property settings of Read (2) or ReadModal (3) are included for backward compatibility, and are available only for forms converted from previous versions of FoxPro.

Example

The following example runs the stop watch (Swatch.scx) control sample.

DO FORM (HOME(2) + 'Solution\Controls\Timer\Swatch.scx')

See Also

COMPILE FORM | CREATE FORM | MODIFY FORM