Multiple instances of an application can be loaded in memory at the same time, but how
Visual Basic deals with instances depends on the object's Instancingproperty. All objects
created in VB have one of the Instancingsettings shown in Table 23.1.
Instancingsetting Value |
Description |
VB4 Equivalent |
Private1 |
Object is only visible and available within its project. |
Creatable = False, Public = False |
PublicNotCreatable2 |
Object is visible to other projects, but can only be created within the
its project. |
Creatable = False, Public = True |
SingleUse3 |
Object is visible to and can be created by other projects. |
Each new CreateObjector Dim As Newcreates a new instance of the object.
None |
GlobalSingleUse4 |
Same as SingleUse, but all methods and properties of the object can omit
the object name (for example, Resetinstead of objCD.Reset). |
None |
MultiUse5 |
Object is visible to and can be created by other projects, but only one
instance of the object is created and all references share that instance. |
Creatable = True, Public = True |
GlobalMultiUse6 |
Same as MultiUse, but all methods and properties of the object can omit
the object name (for example, Resetinstead of objCD.Reset). |
None |
Single-use objects create a new instance for every new object created with
CreateObjector Dim As Newstatements. Multiuse objects use only one instance, regardless of
how many times you call CreateObjector Dim As New. These two types of applications pose
different problems.