胜者为王 粤语:delphi edit控件使用方法

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 22:46:45
我想让一个edit控件只能输入数字 不知道该怎么搞

包括小数点吗?不包括的话,将下列代码写在Edit控件的OnKeyPress事件上

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if (Key<'0') OR (Key>'9') then key := Chr(0);
end;