Share via


FormRun.form Method

Retrieves a Form object that the FormRun class executes.

Syntax

public Form form()

Run On

Client

Return Value

Type: Form Class
A Form object that the FormRun class executes.

Examples

The following example shows a call to the form method to return a Form object. The Form.dataSourceCount method returns the number of data sources that are associated with the form.

static void createForm(Args _args) 
{ 
    Args args; 
    Form form; 
    FormRun formRun; 
    FormBuildDesign formBuildDesign; 
    FormBuildDataSource formBuildDataSource; 
    FormBuildGridControl formBuildGridControl; 
    DictTable dictTable; 
    int idx; 
    int numDataSources;  
 
    // Create the form header. 
    form = new Form(); 
    form.name("myForm"); 
 
    // Add a data source to the form. 
    dictTable = new DictTable(tableNum(custTable)); 
    formBuildDataSource = form.addDataSource(dictTable.name()); 
    formBuildDataSource.table(dictTable.id()); 
 
    // Create the form design. 
    formBuildDesign = form.addDesign('Design'); 
    formBuildDesign.caption("My Form"); 
 
    // Add a control. 
    formBuildGridControl = 
 formBuildDesign.addControl(FormControlType::Grid,'Grid'); 
    formBuildGridControl.dataSource(dictTable.name()); 
    idx = formBuildGridControl.id(); 
     
    // Add data fields. 
    formBuildGridControl.addDataField(formBuildDataSource.id(), 
dictTable.fieldName2Id("AccountNum")); 
    formBuildGridControl.addDataField(formBuildDataSource.id(), 
dictTable.fieldName2Id("Phone")); 
 
    args = new Args(); 
    args.object(form); 
 
    // Create a run-time form. 
    formRun = classfactory.formRunClass(args); 
    formRun.run(); 
    formRun.detach(); 
 
    form = formRun.form(); 
    numDataSources = form.dataSourceCount(); 
}

See Also

Reference

FormRun Class