procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if not (key in [#8,'0'..'9']) then key:=#0; end;