Click or drag to resize

NewObject Function

-- todo --
Creates a new class or object directly from a visual class library (.vcx) file or program (.prg) file without opening the file.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
 FUNCTION NewObject(
Request Example View Source


cClassName (Optional)
Type: Usual
Specifies the class or object from which the new class or object is created.
_args (Optional)
Type: Usual

Return Value

Type: Object
To assign the object reference returned by NEWOBJECT( ) to a variable or array element, use the equal sign (=) or STORE command. If an object assigned to a variable or array element is released, the variable or array element contains the null value. To remove the variable or array element from memory, use the RELEASE command.
For NEWOBJECT( ), X# performs an internal Set CLASSLIB or Set PROCEDURE for the second or third parameters using the ADDITIVE clause where the parameters are first used to determine the search order. If these parameters already exist in the Set CLASSLIB or Set PROCEDURE list, X# rearranges the order in the list so they come first. X# then locates all the classes, creates the object, and calls the Init events. Finally, X# restores the original Set CLASSLIB or Set PROCEDURE list if the installation did not change list.
OLE objects are created with the following syntax for cClassName:
For example, to create a Microsoft Excel worksheet, which supports Automation, use the following syntax:
1oExcelSheet = NEWOBJECT('Excel.Sheet')
See Also