As the name implies a private constructor is a constructor having the access level defined as private. This means that (in most of the scenarios) an instance of the class cannot be created outside the class using this constructor. For information about access level definitions, have a look at
Access Levels in Visual Basic[
^]
A typical scenario is a singleton where you want to have a single instance of a non-static class. This means that once the instance is created all code is using the same instance of the class. An implementation could look like
Public Class Singleton
Private Shared ReadOnly TheInstance As Singleton = New Singleton()
Private Sub New()
End Sub
Public Shared ReadOnly Property Instance As Singleton
Get
Return TheInstance
End Get
End Property
End Class
And the usage like
Dim a As Singleton = Singleton.Instance
Dim b As Singleton = Singleton.Instance
Of course there are other scenarios where a private constructor can be used. For example if you want to define a class and force the usage of a parameter (or parameters) during the construction then you can hide the default constructor by making it private. Consider the following class
Public Class ForcedParameterization
Private Sub New()
End Sub
Public Sub New(somevalue As Integer)
End Sub
End Class
And the usage
Dim c As ForcedParameterization = New ForcedParameterization()
Dim d As ForcedParameterization = New ForcedParameterization(5)