我在程序里使用了InputBox()函数,问题就是:
怎样判断函数的返回值是否能够转换为Integer类型,我就得VB里面有一个Numberic()函数,不知道Delphi里有没有类似的函数?
最好能附上源码,谢谢!

解决方案 »

  1.   

    1.try
      x:=strtoint(y);
    except
      showmessage('input number,please');
    end;
    2.
      x:=StrToIntDef(y, -1000);
      if x=-1000 then
      showmessage('can not convert');
      

  2.   

    var
      tt : string;
      ff : double;
    begin
      tt := inputbox('aa','dd','bb');
      Try
        ff := strtoint(tt);
        showmessage(' it is a number');
      except
        showmessage(' not a number');
      end;
    end;