Hi Everyone,
I'm having a little difficulty trying to determine the actual column object that's displayed in a grid column. Let me explain.
I have a grid that has 10 columns in it. I add a new column to the end of it, but I want it to display in column position 9, so I change the ColumnOrder property to 9. Okay so far. The grid looks the way I want it.
Now, in the BeforeRowColChange event for the grid, I want to to put code that determines which column has just been changed, so that I can find the corresponding Header object and get the name of the column. There are a couple of options available to me:
nColIndex - a parameter passed to the BeforeRowColChange event
This.ActiveColumn - a grid property
When my new column - in grid column 9 - has the focus, both of these values are 9 - the position of the column in the grid. The problem is, my new column is actually Column object 11. If I use This.Columns(9).Header1.Caption - I get the caption for the header1 object of Column9 - not Column11.
I can't seem to find any grid property that will let me determine that Column object 11 (This.Columns(11)) is what is actually displayed in column 9 of the grid. And, of course, it gets even more interesting if the user chooses to move grid columns around.
Am I missing something? Is there a way to find which column object is being displayed in a particular grid column? I'm hoping its something simple and I'm just not thinking about it properly.
John
John Groft
Consultant
Computer Task Group, Inc.