关于判断用户输入的是不是数字型数据 我是这样写的vInt:integer;if (TryStrToInt(trim(moutel_ed.Text),vInt)=false) then....但是当我输入的是数字时也会出错,请问我这样写哪错了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 if StrToIntDef(Edit1.Text,0)=StrToIntDef(Edit1.Text,1) then ShowMEssage('数字'); 在keypress中加 if not (key in ['0'..'9']) then key:=#0; 楼上hch_45的朋友if StrToIntDef(Edit1.Text,0)=StrToIntDef(Edit1.Text,1) then ShowMEssage('数字'); 还是不行 呵呵,在D7中if StrToIntDef(Edit1.Text,0)=StrToIntDef(Edit1.Text,1) then ShowMEssage('数字'); 是没问题的。另,用Val过程(System单元提供的预定义过程)也是一个好主意。 for i:=1 to length(str) dobegin if not (Str[i] in[#48..#57]) then begin showmessage('输入的内容含有非数字的字符'); break; end;end; 参照网上做的indy简单TCP程序,为什么不行 如何通过程序让另外一EXE程序面板隐藏? 关于Indy UDP控件传输一个问题 有关activex使用的问题.新手 菜单问题,17:00前结贴。 搬宿舍,绝对超低价格出售全新图书(附光盘)... 如何通程序来禁用MSCONFIG呀! teechart 的问题 是不是copefile备份出来文件都是只读的,那么SETFILEATTIBUTE()具体怎么用呢? 请问skinData1和SkinCaption1控件如何使用? 谁有可以存图片的listview啊,万分感谢 菜鸟请教问题
ShowMEssage('数字');
if not (key in ['0'..'9']) then key:=#0;
if StrToIntDef(Edit1.Text,0)=StrToIntDef(Edit1.Text,1) then
ShowMEssage('数字');
还是不行
if StrToIntDef(Edit1.Text,0)=StrToIntDef(Edit1.Text,1) then ShowMEssage('数字');
是没问题的。另,用Val过程(System单元提供的预定义过程)也是一个好主意。
begin
if not (Str[i] in[#48..#57]) then
begin
showmessage('输入的内容含有非数字的字符');
break;
end;
end;