The DataSet Can Kiss My Ass

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:

Banks
+---Bank
    +---ABAs
        +---ABA

Some other resources consulted where:

HOWTO: implement IBindingList in Winforms
HOWTO: implement IListSource in Winforms v2

So, needless to say, I’m quite happy. See ya later DataSet!

[Listening to: andromeda]

1 comment

  1. Hey man, if yer gonna bad-mouth VB.Net, at least learn to spell “cough” right. Other than that, thanks for the link to the MSDN example, that’s exactly what I was looking for. Datasets blow.

Comments are closed.