Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
125
Issues with switching grid BindingSource on the fly
posted

I have two different IBindingList classes, one presenting a list of items, and one presenting a list of groups of those same items (so the latter is heirarchical).  When the flat list of items binds to the grid (I'm using a BindingSource), the list has no expandable rows.  When the list of groups binds, each group is an expandable row with the child items under them.  This mostly works, but I am seeing additional bands inserted in the heirarchical view in odd ways, when I bind to that list of groups the second and subsequent time.   Would you know of an example that I could look at of switching data sources on the fly?  Failing that, I'm looking for a workaround to this behavior, and an obvious one would be to completely reset the grid before binding - and I do mean completely reset the grid, settings and contents.  Any suggestions?

Thanks in advance

  • 21382
    Verified Answer
    posted

    One thing you could try is to set the DataSource to null (nothing in VB) before swapping in the new DataSource.  That should clear out all the bands and row structures.