Instancing Property (VB only) |
Only available when a class is part of an ActiveX project. The Instancing property defines how instances of the class are created, and whether or not instances of the class can be created outside of the project. This property is available only at design time.
GlobalMultiUse
The class becomes global to the project in which it's defined; references aren't necessary. For example, most VB language objects are global; as soon as you load the environment, they can be used. Not available within ActiveX Control projects.
MultiUse
The default property value for classes within ActiveX DLL or EXE projects. The class has scope (i.e., it's visible) outside the project in which it's defined, and it can be instantiated using the New keyword or the CreateObject function. Not available within ActiveX Control projects.
PublicNotCreateable
The default property value for classes within ActiveX Control projects. Although the class has scope (i.e., it's visible) outside the project in which it's defined, it can't be instantiated from outside the project using the New keyword or the CreateObject function.
Private
The default property value for classes within standard EXE projects. The class can't be "seen" outside of the project in which it's defined. Also, the only instancing property available in standard EXE projects.
SingleUse
Every call by a client to create the object using either the New keyword or the CreateObject function creates a completely new instance of the object. Only available in ActiveX EXE projects.
GlobalSingleUse
As with the SingleUse property value, every call by a client to create the object using either the New keyword or the CreateObject function creates a completely new instance of the object. However, GlobalSingleUse allows methods and properties to be seen as part of VB. Only available in ActiveX EXE projects.
Use the GlobalMultiUse property setting to create class modules containing enumerated constants for your object model.
Use the MultiUse property setting for top-level objects in a hierarchy or object model.
Use the PublicNotCreatable property setting for child objects created by accessing a function or property of a higher-level object.
Use the Private property setting for objects that are used only within the project.
With the GlobalSingleUse property value, an instance of the class is created automatically for you. It's therefore not necessary to explicitly create an instance of the class.
If the class is part of an ActiveX control project and the control's Public property is set to False, the Instancing property is ignored.