Freigeben über


NewObject Method

Adds a new class or object to an object directly from a .vcx visual class library or program.

Object.NEWOBJECT(cObjectName, cClassName [, cModule [, cInApplication
   [, eParameter1, eParameter2, ...]]])
  • cObjectName
    Specifies the name used to reference the newly added class or object.

  • cClassName
    Specifies the class or object from which the new class or object is added.

  • cModule
    Specifies a .vcx visual class library or Visual FoxPro program (.prg, .mpr, .app, .exe, and so on) containing the class or object specified with cClassName. The default is a .vcx visual class library; you must include an extension if you specify a program.

    Note   A class library can have an alias. To specify a class or object from a class library with an alias, include the class library alias followed by a period and the object name.

    If cModule is omitted, or is the empty string or the null value, Visual FoxPro searches for the class or object in the following order:

    • Visual FoxPro base classes.
    • User-defined class definitions in memory in the order they were loaded.
    • Classes in the current program.
    • Class libraries opened with SET CLASSLIB.
    • Classes in procedure files opened with SET PROCEDURE.
    • Classes in the Visual FoxPro program execution chain.
    • The OLE registry if SET OLEOBJECT is ON.
  • cInApplication
    Specifies the Visual FoxPro application (.exe or .app) containing the .vcx visual class library you specify with cClassLibName. You must include an extension for the application. CInApplication is ignored if cModule is omitted, or if cInApplication is the empty string or the null value.

  • eParameter1, eParameter2, ...
    Specifies optional parameters that are passed to the Init event procedure for the class or object.

Remarks

The NEWOBJECT method makes it possible for you to add a new class or object to an object without opening a .vcx visual class library or procedure file.

See Also

AddObject Method | AddProperty Method | Class Designer | CREATE CLASS | CREATE CLASSLIB | CREATEOBJECT( ) | DEFINE CLASS | NEWOBJECT( )

Applies To: Column | CommandGroup | Container Object | Custom | DataEnvironment | Form | FormSet | Grid | OptionGroup | Page | PageFrame | _SCREEN | ToolBar | Session Object