>Hi All,
>
>I would like to show records via a grid control with an alternating backcolor.
>
>The following works well if based on the RECNO() function, like so:
>
>
>frmMyForm.grdGrid1.SetAll("DynamicBackColor", ;
> "IIF(MOD(RECNO( ), 2)=0, RGB(255,255,255) ;
> , RGB(0,255,0))", "Column")
>
>
>If I change the controlling order of the underlying table however, it obviously won't work.
>
>How do I maintain the alternating backcolor even with different controlling order?
>
>Thanks in advance,
>
>Dennis
Hello Dennis:
If you are willing to use a cursor and are using VFP9, how about the following example. Works just great:
Create the cursor after you have set the index:
****Grid.INIT()
Select customer
Set Order To Tag custno
Select customer.*, Cast(Iif(Mod(Recno(),2) =0,.T.,.F.) As l) As test ;
FROM customer ;
WITH (Buffering = .T.) ;
Into Cursor gtest
With This
.RecordSource = "gtest"
.RecordSourceType = 1
.SetAll("DynamicBackColor", ;
"IIF(gtest.test, RGB(255,255,255) , RGB(0,255,0))", "Column")
Endwith
You will have to fine tune to suit your needs.
Mohammed