2
Answers

Accessing object within list

Craig Davis

Craig Davis

9y
687
1
I have a parent object Z which contains a list of child objects.  I would like to access the properties of the child objects within the list.
 
I wrote code to access the first object in the list.  The code compiles correctly but returns a (object reference not set to instance of an object) error when I run the application.
 
Here is part of the code:
 
zparentobject= new Zclass();
childclass zchildobject = new childclass();
zchildobject=zparentobject.listz[0];  * source of error*
 
Help?
Answers (2)