Populating a VB Class that was generated by XSD.EXE errors with Null Reference

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
After Generating a VB.NET Class using XSD.EXE, I get "object reference not set to an instance of an object" error whenever I reference a child record of a complex type with unbounded maxOccurs.
So, for example my Class "Club" has unbounded "Members" each with a "FirstName" and "LastName", I can create an object that is Club.Members() type and I can populate that object with a FirstName and LastName, but when I go to actually populate Club.Member(0)
with that objects values, I get a Null Reference Exception, because Club.Members() is Nothing.
I cant seem to create the Club.Members() array so I can add members to it.
I dont know if it is the xsd itself, the way I am generating the class with xsd.exe, or that I am just missing how to instantiate the Club.Members() object.
Any assistance would be appreciated.
mp
<hr class="sig mp

View the full article
 
Back
Top