This article will be very useful if you are going to know what is the reason for it through this article VB.Net program to create an array of objects of the class We are going to know very clearly about this.

VB.Net program to create an array of objects of the class
'VB.Net program to create an array of objects of the class.
Class Sample
Private num1 As Integer
Private num2 As Integer
Public Sub SetValues(ByVal n1 As Integer, ByVal n2 As Integer)
num1 = n1
num2 = n2
End Sub
Public Sub PrintValues()
Console.WriteLine("Num1: " & num1)
Console.WriteLine("Num2: " & num2)
End Sub
End Class
Module Module1
Sub Main()
Dim obj(2) As Sample
obj(0) = New Sample()
obj(1) = New Sample()
Console.WriteLine("Object(0) data:")
obj(0).SetValues(10, 20)
obj(0).PrintValues()
Console.WriteLine(vbCrLf & "Object(1) data:")
obj(1).SetValues(30, 40)
obj(1).PrintValues()
End Sub
End Module
Object1 data:
Num1: 10
Num2: 20
Object2 data:
Num1: 30
Num2: 40
Press any key to continue . . .
Final Words
I owe it to you to provide the VB.Net program to create an array of objects of the class article in a very simple way. Let us know in the comment box if you need more useful information.