procedure TEdit.OnKeyPress(Sender:TObject; var Key:Char); begin if Key=',' then Edit.MaxLength:=Length(Edit.text)+2; end;