M
Michele
Hi,
I have trouble with an array of objects!
I declared a class like this:
Public Class myClass
Public X As String
Public Y As Integer
Public Z As String
Public Sub New()
X = ""
Y = 0
Z = ""
End Sub
End Class
when in another class i try to declare an instance of it
Dim MyArray as New myClass
myArray.X = "ggggg"
it's work fine, but if i try to declare an array of objects using
Dim MyArray() as myClass
myArray(0).X = "ggggg"
i get the following error message:
Unhandled exception "System.NullReferenceException" in myProject.exe
Reference to an object without object instance.
can you help me with it?
thanks
Michele
I have trouble with an array of objects!
I declared a class like this:
Public Class myClass
Public X As String
Public Y As Integer
Public Z As String
Public Sub New()
X = ""
Y = 0
Z = ""
End Sub
End Class
when in another class i try to declare an instance of it
Dim MyArray as New myClass
myArray.X = "ggggg"
it's work fine, but if i try to declare an array of objects using
Dim MyArray() as myClass
myArray(0).X = "ggggg"
i get the following error message:
Unhandled exception "System.NullReferenceException" in myProject.exe
Reference to an object without object instance.
can you help me with it?
thanks
Michele