I have two grids:
in one form and compare between two value
I need to change the color of the column in the grid when the two values are not equal
TotalYear:=0 ;
while not (mTblDetail.eof) do
begin
TotalYear:=TotalMonth +mTblDetail.FieldByName('Target_').AsFloat;
mTblDetail.Next;
end;
TotalMonth:=0;
while not(DataSet.Eof) do
begin
TotalMonth:=TotalMonth+DataSet.FieldByName('Target_').AsFloat;
DataSet.Next;
end;
I need to compare the two values and change the color
if(TotalYear<>TotalMonth) then
I tried to use this :
DataSet.Columns[8].Color:= clRed
but is displays an error "Not Accepted". How Can change the color of a column of a Tcxgrid?
Coloring in cxGrids is best done via cxStyles. Drop a TcxStyleRepository on the form and add some styles. You can assign them to the View.Styles.* properties or via events like OnGetContentStyle. I'm sure the online help contains an overview with screenshots and examples.