Hi i have a Tstringgrid with a currency fields and a Tlabel.What i want to do is when i change one currency field of the stringgrid calculates imediatly the label with the sum of all fields.Thanks
procedure TForm1.StringGrid1SetEditText(Sender: TObject; ACol,
ARow: Integer; const Value: String);
var i : integer; Sum:single;
begin
Sum:=0;
for i := 1 to StringGrid1.RowCount do
try
if StringGrid1.Cells[ACol,i] <> '' then
Sum:= Sum + StrToFloat( StringGrid1.Cells[ACol,i]);
except
// ignore any errors in conversion
end;
Label1.Caption := FloatToStr(Sum);
end;
That works in D7, there should be similar things in other versions of Delphi.
But my problem is the same.I have in a table one field with for example 3 records of currency type and by other side a dbtext.What i want is when i change a value of the records will change too the sum into dbtext.Thanks.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.