>>Nope. Won't work. ColumnOrder values do not have to be contiguous. That is, columnorder values can be 1,5,12,19; all that happens is that VFP displays the columns in that order. The absolute values are not used, just the values relative to one another.
>>
>>Thanks
>What ? Reread the code. Of course columnorders need not be in order otherwise just using this.columns(this.activecolumn) would be sufficient. This method finds original columns collection index. That is : If you have columns named Column1, Column2..ColumnN, put this code to ARCC and add and textbox control named text1 and mix their order anyway on the fly :
LPARAMETERS nColIndex
>local ix
>with this
> nActiveColumn = .ActiveColumn
> for ix = 1 to .columncount
> if .columns(ix).ColumnOrder = nActiveColumn
> ThisForm.txtbox1.value = .columns(ix).name
> exit
> endif
> endfor
>endwith
This at least works in VFP5 and part of my grid class for the same purpose. I just got VS6 package and don't know if something has changed yet(hope not).
>Cetin
Still don't get it, Cetin.
Lets do an example. I have three columns named Column1 with columnorder = 6, column2 with columnorder = 4, and column3 with columnorder = 56. Silly, but you can do this. The columns will appear on the screen in the order column2, column1 and columnn3.
If I click on the text box in column2, this.ActiveColumn will be 2. But NONE of the columns in the collection have a ColumnOrder property with the value of 2.
Thus the IF statement will never find a match.
It WILL work if the columnorder properties are (in my example) 2,1 & 3. But when they are 6,4 & 56, there is no match.
Or am I really missing something here?
Larry