W wangny Unregistered / Unconfirmed GUEST, unregistred user! 2007-12-03 #1 在EDIT里输入带有小数点的数字,如何才能判断出里面的数字大于设定的数值? 比如我输入0.85,按下按钮就会提示这里的数值大于0.75?
J jym013 Unregistered / Unconfirmed GUEST, unregistred user! 2007-12-03 #2 使用字符串转数据值的函数判断一下即可. strtofloat
A admin2008 Unregistered / Unconfirmed GUEST, unregistred user! 2007-12-04 #3 if not (key in['0'..'9','.'.#8,#13] then key=#0 ; if strtofloat(edit1.text)>0.75 then ...............................
if not (key in['0'..'9','.'.#8,#13] then key=#0 ; if strtofloat(edit1.text)>0.75 then ...............................
隐 隐士山人 Unregistered / Unconfirmed GUEST, unregistred user! 2007-12-04 #4 procedure TForm1.Button1Click(Sender: TObject); begin if strtofloat(edit1.text)>0.75 then showmessage('大于设定数'); end;
procedure TForm1.Button1Click(Sender: TObject); begin if strtofloat(edit1.text)>0.75 then showmessage('大于设定数'); end;
W wangny Unregistered / Unconfirmed GUEST, unregistred user! 2007-12-05 #5 谢谢三位网友的指点,隐士山人网友的例子最为完整,所以给最多分,谢谢大家!