我是这样写的
vInt:integer;
if (TryStrToInt(trim(moutel_ed.Text),vInt)=false) then....
但是当我输入的是数字时也会出错,请问我这样写哪错了。

解决方案 »

  1.   

    if StrToIntDef(Edit1.Text,0)=StrToIntDef(Edit1.Text,1) then
      ShowMEssage('数字');
      

  2.   

    在keypress中加
       if  not (key in ['0'..'9']) then key:=#0;
      

  3.   

    楼上hch_45的朋友
    if  StrToIntDef(Edit1.Text,0)=StrToIntDef(Edit1.Text,1)  then  
       ShowMEssage('数字'); 
    还是不行
      

  4.   

    呵呵,在D7中
    if StrToIntDef(Edit1.Text,0)=StrToIntDef(Edit1.Text,1) then ShowMEssage('数字'); 
    是没问题的。另,用Val过程(System单元提供的预定义过程)也是一个好主意。
      

  5.   

    for i:=1 to length(str) do
    begin
      if not (Str[i] in[#48..#57]) then
      begin
        showmessage('输入的内容含有非数字的字符');
        break;
      end;
    end;