Share via


FormRun.objectSet Method

Retrieves a FormObjectSet object for a specified form data source.

Syntax

public FormObjectSet objectSet([anytype objectSet])

Run On

Client

Parameters

  • objectSet
    Type: anytype
    A specified form data source; optional.

Return Value

Type: FormObjectSet Class
A FormObjectSet object for a specified form data source.

Remarks

Use an integer or string for the objectSet parameter. An Integer data type specifies the one-based index of a data source in the form data source list. A String data type specifies the name of a data source in the form data source list.

If you do not pass the objectSet parameter, the data source that is associated with the form control that currently has focus is returned. If no form control currently has focus, the default data source is returned. If a default data source has not been specified, the first data source in the form is returned.

The objectSet method returns a null Nothing nullptr unit a null reference (Nothing in Visual Basic) value if a data source is not found.

To specify the default data source, call the FormRun.defaultDataSource method.

Use the return value from the objectSet method to instantiate the FormDataSource class.

Examples

The following example shows a call to the objectSet method to return a FormObjectSet object for a specified form data source.

static void createForm2(Args _args) 
{ 
    Args args; 
    Form form; 
    FormRun formRun; 
    FormObjectSet formObjectSet; 
    FormBuildDesign formBuildDesign; 
    FormBuildDataSource formBuildDataSource; 
    FormBuildGridControl formBuildGridControl; 
    DictTable dictTable; 
    int idx; 
    
    // 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(); 
 
    formObjectSet = formRun.objectSet(1); 
}

See Also

Reference

FormRun Class