昆明国土资源工程学院:delphi edit控件使用方法

来源:百度文库 编辑:高校问答 时间:2024/05/15 10:22:07
我想让一个edit控件只能输入数字 不知道该怎么搞

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

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