Hi,
I encountered a bug that in the event of AfterColPosChanged, the VisiblePosition returned from e.ColumnHeaders(0).VisiblePosition is wrong.
Example:
In the grid i have column1, column2 and column3 (Left to Right).
I removed Column2.
Drag Column1 into Column3 position.
Now in the AfterColPosChanged event, e.ColumnHeaders(0).VisiblePosition is 2, which is WRONG. It should be 1, because there is only 2 visible columns (zero based index)
Please help.
I'm not sure exactly what you mean by "I removed Column2." Is this an unbound column that you removed? Or did you mean that you are hiding the column?
I hidden column does not change it's VisiblePosition, so the numbers you are getting here are correct. The column is not visible when Hidden, but it maintains the same VisiblePosition. It has to do this, because otherwise when you hide a column and then show it again, it would not come back to the same position.
Hi Mike,
"Removed" means hide it (uncheck the box in columnchooser). So how can i work around this to get the correct visibleposition? Basically the column2 that is hidden now, column 1 and column 3 is visible on the grid. When I drag the column 1 to column 3 position, how can I tell what the new visible position is for the column1 on the grid ? I need to know the actual position that is shown on the grid, not including the hidden columns.