I have downloaded the sample code to place a checkbox in the column header.
When the program gets to the Sub AfterCreateChildElements and runs the line aColHeader = CType(parent, HeaderUIElement).Header, I get this error message :
Unable to cast object of type 'Infragistics.Win.UltraWinGrid.BandHeader' to type 'Infragistics.Win.UltraWinGrid.ColumnHeader'.
Is there something in my grid that causes this or does it need another test for BandHeader here?
Hi,
I guess the original sample didn't have any BandHeaders in the grid. You should probably just check to make sure that Header is a ColumnHeader before proceeding.
Mike,
You are correct. The original post does not have a BandHeader. And I am trying to figure out the code to test a HeaderUIElement to see if it is a Band Header or Column Header.
The easiest thing to do is just to check the Header and make sure it's a ColumnHeader before you assign it to aColHeader:
if typeof CType(parent, HeaderUIElement).Header is ColumnHeader Then
Another way to do it would be to check if the column is not null:
if CType(parent, HeaderUIElement).Column != null Then