DBEdit - formatar numeros com decimais

Top  Previous  Next

No OnKeyPress do componente (DBedit, Edit, etc) coloca o código abaixo

begin

  if not(key in ['0'..'9','.',',',#8,#13]) then key := #0;

  if key in [',','.'] then  key := DecimalSeparator;

  if key = DecimalSeparator then

    if pos(key,TEdit(Sender).Text) <> 0 then key := #0;

end;