Topic: Format Float
Happy New Year to all.............
How can I format currency field with thousand separator and decimals when field value is called from an another form?
For example, I like the field "Price" on form1 display 42,562,314.25 not 4256231425
I tried the following script but didn't work:
// ***** if the user is scrolling through the grid using the keyboard
procedure Form1_TableGrid1_OnKeyUp (Sender: string; var Key: Word; Shift, Alt, Ctrl: boolean);
var
i,c: integer;
begin
Form1.edName.Text := SQLExecute('SELECT itemName FROM inv WHERE id='+inttostr(form1.TableGrid1.dbitemid));
Form1.edPrice.Text := SQLExecute('SELECT price FROM inv WHERE id='+inttostr(form1.TableGrid1.dbitemid));
//Form1.edPrice.text := FormatFloat('#,##0.00', Form1.edPrice.text);
end;
//***** if the user is scrolling through the grid using the mouse
procedure Form1_TableGrid1_OnCellClick (Sender: string; ACol, ARow: Integer);
var
i,c: integer;
begin
Form1.edName.Text := SQLExecute('SELECT itemName FROM inv WHERE id='+inttostr(form1.TableGrid1.dbitemid));
Form1.edPrice.Text := SQLExecute('SELECT price FROM inv WHERE id='+inttostr(form1.TableGrid1.dbitemid));
//Form1.edPrice.text := FormatFloat('#,##0.00', Form1.edPrice.text);
end;
Please see the attached sample project.
God... please help me become the person my dog thinks I am.