Hi!
This was discussed a lot in past times, and there are no any good solution but add an additional field to the grid record source alias that holds the order number value. After you change order of the records in alias, re-numerate records in new order using this additional field. Than base grid rows coloring on that number, not on the recno() that shuffles as soon as you set another order in alias. For read-only record sources you can use the related cursor. Create the cursor with order numbers and recno() values (2 integer columns). Populate it by data to have the same number of records as the main record source. Index on the recno() values field, than establish the relation from main record source (recno()) to the order numbers cursor (recno() values field). When you change the order in main alias, re-calculate order number in the child cursor. You can display order number in grid if you want (this approach originally intended to be made for this - to display order number in the items list). You can base the coloring in that alias. This is because relation - record in the shild cursor will be set automatically properly to the main record source. Second approach is more universal, however it requires more accurate programming and understanding of how it functioning.
Good luck!
>hi,
>i have a grid in which the backcolor of the row is alternative,i.e first row is black and second row will be of some other color. the command is,
>
>THISform.grid1.SetAll("dynamicbackcolor", ;
> "IIF(round(recno()/2,0) = recno()/2, RGB(0,0,0), RGB(232,232,232))", "Column")
>
>but if'll change the order of the grid, my rows backcolor gets shuffel because of recno(). But can i avoid this even though due to order the recno changes.
>
>thanku.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.