try
  strtoint(Edit1.Text);
except
  showmessage('不合法!');
end;

解决方案 »

  1.   

    我的方法比较笨,Try一下,试图把Edit中得字符转换为Integer。无错误就通过,有错误,
    在Except中捕获。
      

  2.   

    如果是用delphi6的话,用TryStrToInt函数。
      

  3.   

    我自己写了一个Edit控件,
    可以选择只能输入整型、浮点型、所有的字符,
    还可以设置显示格式,如:¥12,345.67,(不是MASK)
    你要的话给我MAIL:[email protected]   
      

  4.   

    解决的方法很多
    其中,简单的方法是用DBedit,它可以自动监测数据的合法性,整数的字段字符是输不进去的。
    也可以在edit的onchange事件中if key not in[0..9] then
     ShowMessage('error!');
    也可以在edit的onexit事件中 
    var 
      a,b:integer;
    begin
     val(edit1.text,a,b);
     if a<>0 then
      ShowMessage('error');
    end;