//This code worked for me very well
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var Valor: Double;
begin
try
StrData := StrData + Key;
EliminarFormato(Trim(StrData));
Valor := StrToFloat(StrData);
Edit1.Text := Format('%8.0n',[Valor]);
Key := #03;
SendMessage(Edit1.Handle,WM_KEYDOWN,VK_END,0);
except on E: Exception do
StrData := '';
end;
end;
function TForm1.EliminarFormato(const Data: string): string;
var Datos: string;
I: Word;
begin
Datos := Trim(Data);
repeat
I := Pos('.',Datos);
if I > 0 then
Delete(Datos,I,1);
until (Pos('.',Datos) = 0);
Result := Datos;
end;