I think the problem is (I could be wrong here) that by changing then Field.Text you are actually attempting to change the underlying datasets field data, which is, by the looks of it, a float or currency field.
From what I can tell you want to put a '+' sign in the Price Column if it matches the criteria.
Try this work around, using the OnDrawDataCell Event (which is apparently obsolete but my version of IP doesn't have the OnDrawColumnCell)
Procedure TformREDB.dbGridSearchDrawDataCell(Sender : Tobject; const Rect : Trect; Field : Tfield; State : TGridDrawState);
Const
PlusSign = '+';
Begin
if (field.name = 'tblClientPrice') and (tblClientType.asInteger = 2) then
wwwdbGridSearch.Canvas.TextOut(Rect.Left + 5, Rect.Top + 1, PlusSign); // you might want to play with the rect.left to //get a value that looks good.
End;
-----Original Message-----
From: John Christenhusz [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 15 August 2001 10:09
To: Multiple recipients of list delphi
Subject: [DUG]: TwwdbGrid
Hi folks,
I want to change the text in a TwwdbGrid for a particular item. The following code doesn't work:
procedure TformREDB.dbgridSearchCalcCellColors(Sender: TObject; Field: TField;
State: TGridDrawState; Highlight: Boolean; AFont: TFont; ABrush: TBrush);
begin
if (field.name = 'tblClientPrice') and (tblClientType.asInteger = 2) then
field.text := '+ ' + field.text;
end;
It generates the following error: '+ ' is not a valid floating point value for field 'Price'
Any ideas how to solve this problem?
TIA
John.
