Tariq
Ijn my experience columns have stayed where they are unless you goof with them. Your code below is goofing with the column order so, if you want them to stay where they are, don't goof with them.
Now, I'm not sure what you're trying to do with that code but it's possible that properties such as columnorder aren't changed where and/or when you think. How about:
With thisform
.lockscreen = .T.
With .grdMyGrid
lnLeftCol = .Column1.LeftColumn
.Column1.ColumnOrder = lnLeftCol
.Column2.ColumnOrder = lnLeftCol + 1
.Refresh()
EndWith
.lockscreen = .F.
EndWith
The following code I don't understand what it refers to:
>IF dodefault( nColIndex)
> this.nCurrRec = RECNO()
>this.Refresh()
>ENDIF
How is .nCurrRec a property of the grid?
HTH
Terry
>Dear Experts
>
>Grid1 has 15 columns in original column order from 1 to 15.
>The left most two columns are freezed.
>While scrolling cursor in grid, the column order is changed.
>How to keep coloumns in their original columns order set.
>I have following codes on AfterRowColChange.
>Please help
>
>
>thisform.lockscreen = .T.
>IF This.Column1.ColumnOrder <> This.LeftColumn THEN
> this.Column1.ColumnOrder = This.LeftColumn
> this.Column2.ColumnOrder = This.Column1.ColumnOrder + 1
>ENDIF
>*----------------------------
>IF dodefault( nColIndex)
> this.nCurrRec = RECNO()
>this.Refresh()
>ENDIF
>*----------------------------
>thisform.lockscreen = .f.
>thisform.REFRESH
>
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.