This documentation is archived and is not being maintained.

Component Instancing Changes in Visual Basic

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 Instancing

Visual Basic .NET


Class Access attribute: Private


Class Access attribute: Public. Declare the constructor Friend (Friend Sub New)


Not supported*


Not supported*


Class Access attribute: Public. Declare the constructor Public (Public Sub New)


Not 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.