Ok - stuck on something I clearly don't understand well....
In the code below (which I just wrote here - it closely mirrors what my actual code is...) the problem is with the line:
Thing.ThingObje ct.Add(MyObject )
It says: "Object reference not set to an instance of an object"
Yes - it is "nothing" before I try to use the Add method so I must be doing something basic and wrong.
The object I am trying to add is fine - I can tell you it is correct, it's just that I apparently cannot use the .add method on the Thing.ThingObje ct until it is properly created - which I have apparently not done.
I'm hoping this is just a syntactical thing.....
In the code below (which I just wrote here - it closely mirrors what my actual code is...) the problem is with the line:
Thing.ThingObje ct.Add(MyObject )
It says: "Object reference not set to an instance of an object"
Yes - it is "nothing" before I try to use the Add method so I must be doing something basic and wrong.
The object I am trying to add is fine - I can tell you it is correct, it's just that I apparently cannot use the .add method on the Thing.ThingObje ct until it is properly created - which I have apparently not done.
I'm hoping this is just a syntactical thing.....
Code:
Private Sub DoThing()
Dim MyObject as New Object
MyObject = MakeMyObject
Dim Thing as New ListOfThings
Thing.ThingObject.Add(MyObject)
End Sub
Partial Public Class ListOfThings
Inherits Object
Private vThingObject as ArrayOfThings
Public Property ThingObject as ArrayOfThings
Get
return vThingObject
End Get
Set
vThingObject = Value
End Set
End Property
End Class
Public Class ArrayOfThings
Inherits System.Collections.Generic.List(of Objects)
End Class
Comment