Hi Derek and Manixs,
I'm not sure that you would actually ever have both a deposit and a withdrawal against the same transaction (as per both layouts)...
My apologies for not making my layout clear. I should have added additional two columns (cost of deposit and cost of withdrawal) in addition and show deposits and withdrawal in separate columns. At my end I wanted to use running balance in banking terms.
Manixs' calc field formula with printf("%.2f",... seems to be working OK. Thanks for sharing Manixs.
When formatting tGrid cell values with decimals and thousand separator;
the following works fine without printf("%.2f",... calc fields and on form calcs:
procedure Form1_tgMain_OnChange (Sender: string);
begin
if form1.tgMain.Columns[4] is TNxNumberColumn then
begin
TNxNumberColumn(form1.tgMain.Columns[4]).FormatMask := '#,###,##0.00'; //
TNxNumberColumn(form1.tgMain.Columns[6]).FormatMask := '#,###,##0.00'; //
end;
end;
However, the above didn't work with calc field containing printf("%.2f",...
I found out that old method below worked with calc field containing printf("%.2f",...
procedure Form1_tgMain_OnChange (Sender: string);
var i,c: integer;
begin
Form1.tgMain.BeginUpdate;
c := Form1.tgMain.RowCount - 1;
for i := 0 to c do
begin
Form1.tgMain.Cells[8, i] := FormatFloat('#,##0.00', Form1.tgMain.Cell[8, i].AsFloat);
Form1.tgMain.Cells[9, i] := FormatFloat('#,##0.00', Form1.tgMain.Cell[9, i].AsFloat);
end;
Form1.tgMain.EndUpdate;
end;
Just wanted to share in case others may encounter the same issue and also for correction if needed.
Adam
God... please help me become the person my dog thinks I am.