In the code below (which I just wrote here - it closely mirrors what my actual code is...) the problem is with the line:
Thing.ThingObject.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.ThingObject until it is properly created - which I have apparently not done.
I'm hoping this is just a syntactical thing.....
Expand|Select|Wrap|Line Numbers
- 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