This documentation is archived and is not being maintained.

Component Instancing Changes in Visual Basic .NET

In Visual Basic 6.0, instance creation was controlled by the Instancing property of a class, which set both the access level (Public, Private, Friend) of a class and the way an object could be created.

In Visual Basic .NET, you set the access modifier for a class to Public, Private, or Friend, and then specify the user's ability to create instances of the class by setting the access level of the constructor (Sub New), as shown in the following table.

Visual Basic 6.0 InstancingVisual Basic .NET
PrivateClass Access attribute: Private
PublicNotCreatableClass Access attribute: Public
Declare the constructor Friend (Friend Sub New)
SingleUseNot supported*
GlobalSingleUseNot supported*
MultiUseClass Access attribute: Public
Declare the constructor Public (Public Sub New)
GlobalMultiUseNot supported*

* There is no combination of class access and constructor access that duplicates SingleUse, GlobalSingleUse, or GlobalMultiUse. You can get an effect similar to GlobalMultiUse by importing a class into a client program, although this only makes shared members accessible without qualification. Public modules also allow a similar effect.

See Also

Component Instancing and Constructors | Component Class Characteristics | Initialization and Termination of Components