先锋音响专卖:delphi edit控件使用方法

来源:百度文库 编辑:神马品牌网 时间:2024/05/14 00:52:52
我想让一个edit控件只能输入数字 不知道该怎么搞

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

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