>>Justok,
>>First the expression is wrong. You must put the whole expression as a char string :
.DynamicBackColor = "IIF(Empty(myTable.Field1),rgb(0,0,0),rgb(192,192,255))"
Next, to make the life easier for you, you could delegate the coloring to a function :
>>for each oColumn in ThisForm.Grid1.columns
>> oColumn.DynamicBackColor = "GimmeColor(["+oColumn.Controlsource+"])"
>>endfor
Your function would then return a color based on controlsource.
>>Cetin
>
>
>Thanks both of you!
>
>What happen if I pass "This.name" inside setall() function?
>
>Thisform.grd1.SetAll("Caption", "This.Name", "Header")
>
>grd1.name or header1.name ?!
>
>if use header1.name, I can do:
>
>Thisform.grd1.SetAll("DynamicBackColor", "Thisform.GimmeColor(This.ColumOrder)", "Column")
>
>^_~
Unfortunately you cannot. If you setall("Caption", "This.Name", "Header") then all your captions would literally be "This.Name". If you don't put the quotes then depends on where you call it from and only evaluated once at the time of call.
For dynamic* properties this refers the grid. ColumnOrder is a property of column not grid. That means you wouldn't be able to use this.ColumnOrder.
This sample cross highlights a cell (column + row is highligted) :
this.SetAll("DynamicBackColor", ;
"iif(recno(this.recordsource) = thisform.nCurRec or " +;
"this.activecolumn > 0 and this.columns(this.activecolumn).controlsource "+;
"= lower(this.recordsource+'.'+varread()), 256^2-1,256^3-1)","Column")
Cetin