Are arrays of objects possible ?
-
I have an object
Public Class Plateobj Public Order As String Public Row As String Public Column As String End Class
I want to create an array of the Plateobj'sDim plateinfo() As Plateobj
And then refrence them as followplateinfo(0).Order = "One"
But I get the following error "Object refrence not set to an instance of an object" I guess I am doing something daft, any clues welcome Ta Very Much -
I have an object
Public Class Plateobj Public Order As String Public Row As String Public Column As String End Class
I want to create an array of the Plateobj'sDim plateinfo() As Plateobj
And then refrence them as followplateinfo(0).Order = "One"
But I get the following error "Object refrence not set to an instance of an object" I guess I am doing something daft, any clues welcome Ta Very Muchyou still have to initialize the object as follows
Public Class Plateobj Public Order As String Public Row As String Public Column As String End Class Dim plateinfo() As Plateobj '***** plateinfo(0) = new plateobj() '***** plateinfo(0).Order = "One"
-
you still have to initialize the object as follows
Public Class Plateobj Public Order As String Public Row As String Public Column As String End Class Dim plateinfo() As Plateobj '***** plateinfo(0) = new plateobj() '***** plateinfo(0).Order = "One"
Kevin, Thanks tried that and still get the same error (on the initalise). Geoff
-
Kevin, Thanks tried that and still get the same error (on the initalise). Geoff
try this
'declare the array dim plateInfo() as Plateobj 'set its bounds redim plateInfo(10) 'initialze the array item plateinfo(0) = new Plateobj() 'now work with it plateInfo(0).order = "One"
-
try this
'declare the array dim plateInfo() as Plateobj 'set its bounds redim plateInfo(10) 'initialze the array item plateinfo(0) = new Plateobj() 'now work with it plateInfo(0).order = "One"
Are the objects in the area always going to be Plateobj? If so you should consider using Generics. Kinds Pseudo Code... in C#, List LobjList = new List(); LobjList.Add(new Plateobj()); LobjList[0].order = "One;
Christopher Pond Innovative Technology Solutions SpartanSoft.net.
-
try this
'declare the array dim plateInfo() as Plateobj 'set its bounds redim plateInfo(10) 'initialze the array item plateinfo(0) = new Plateobj() 'now work with it plateInfo(0).order = "One"
AaaaHa It works thanks, maybe the day was not wasted Cheers Geoff
-
Are the objects in the area always going to be Plateobj? If so you should consider using Generics. Kinds Pseudo Code... in C#, List LobjList = new List(); LobjList.Add(new Plateobj()); LobjList[0].order = "One;
Christopher Pond Innovative Technology Solutions SpartanSoft.net.
Um I suspect I will end up with other object as I am reading data from oracle and flat data file and writing updates back. I will give it a go though, knowledege is power as they say. Thanks Geoff
-
I have an object
Public Class Plateobj Public Order As String Public Row As String Public Column As String End Class
I want to create an array of the Plateobj'sDim plateinfo() As Plateobj
And then refrence them as followplateinfo(0).Order = "One"
But I get the following error "Object refrence not set to an instance of an object" I guess I am doing something daft, any clues welcome Ta Very MuchUse a Collection!