Display Hierarchy of ADO.NET data in WinForms DataGrid
Posted on 2003-03-17
Hi. I have a lovely XML schema which already has DataRelations defined between master and detail tables. (Think the traditional "Orders" and "OrderDetails" tables). I also have a Windows form containing a DataGrid control and a combobox control that allows my user to select any table from the XML schema.
Everything works fine except for the DataGrid automagically honoring my DataRelations. I'm sure there's something more I need to do, but I'm not sure how to go about it.
I'm looking for some VB code that demonstrates how to do this...basically, given a DataTable object, (1) determine if it has ChildRelations, and (2) if so, display those relationships in the DataGrid (ideally, each "master" record would be expandable, or something to that effect).
I've been searching around online, but haven't seen a good example of this in VB.NET so far.
Thanks a lot.