Disable alpha character in Edit

Posted in Components

You may use OnKeyPress event of your Edit. You should check, if key parameter is not in set '0'..'9' then you must write Key:=#0;

var
  NumSet: set of Char = ['0'..'9'];

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if not (Key in NumSet) then
    Key:=#0;
end;