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
Adding and removing columns at runtime


I have an ultragrid with 2 bound columns on it.  I want to be able to create and remove columns at runtime.

When an event fires in my application, I need to refresh the grid's columns.  I want to delete all the unbound columns from my grid, and then add in columns again.  The columns are being added to an UltraGridGroup when they are created, by setting

column.Group = grid.DisplayLayout.Bands(0).Groups("grpName")


I tried using


but that doesn't seem to work correctly.  It looks like they are being deleted, but maybe the Group is holding on to them (???).  When I try to add the columns back in, I get an error that the Key already exists when I try to set the column.Group again.  My column keys are unique, so I don't know what's wrong.

Any thoughts?