tentavarious
asked on
how to create a array from a new instance of a class
Experts, i am trying to create an array object from a class, but i get an error arrays cannot be declared as new. When i try to run i get instance not set to an instance of an object. Any ideas? Can someone provide me with an example?
In my form code
dim ipa as new ipdata
ipa.ID_HEAD(0).Supplier_IP = "13.15.23.18" 'not set to instance of an object
I shorten up the class a lot, but there are a lot more variables.
In my form code
dim ipa as new ipdata
ipa.ID_HEAD(0).Supplier_IP
I shorten up the class a lot, but there are a lot more variables.
Partial Public Class IPDATA
Private ip_HEADERField() As Header_Info
Public Property ID_HEAD() As Header_Info()
Get
Return Me.ip_HEADERField
End Get
Set
Me.ip_HEADERField= value
End Set
End Property
End Class
Partial Public Class Header_Info
Private IP_ReferenceField As String
Public Property Supplier_IP() As String
Get
Return Me.IP_ReferenceField
End Get
Set
Me.IP_ReferenceField = value
End Set
End Property
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I was going to remove the arrays out of the main class and try something like this, but i think your ways is better
Dim ipArray(10) As IPDATA
For i = 0 To 9
Dim myip As IPDATA= New IPDATA()
myip.ip_head="test"
ipArray(i) = myip '
Next