I can now officially say that the DataSet can kiss my lilly white ass! I have just successfully data bound a custom collection that contains objects that have a property containing another collection. All collection classes derive from CollectionBase, and implements IBindingList. The individual objects implement IEditableObject. This also now makes the design pattern I’m using ready for primetime.
I wasn’t sure how I was going to handle DataBinding in WinForms apps w/o a DataSet. Guess what? I can. Anyway, I followed this example at MSDN, Windows Forms Data Binding and Objects. It’s a caugh VB.NET caugh example, but I was able to extrapolate what I needed.
The only thing left was how to setup the DataGrid. I set the DataSource to the parent object collection:
ABADataGrid.DataSource = banks;
ABADataGrid.DataMember = "ABAs";
and the DataMember is the property name on a individual parent object,
Bank, that contains the collection of child elements. This wound up working like a charm. The hierarchy is as follows:
Some other resources consulted where:
So, needless to say, I’m quite happy. See ya later DataSet!