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