edit控件中的text属性,当没有任何值输入时,如何判断它的值是空的?
用edit1.text=''不行呀?edit1.text=null也不行?
因为我要用strtofloat(edit1.text),此函数在edit1.text为空时不正常,我需要提前判断,以避免此情况。

解决方案 »

  1.   

    用 yhncom_36(事业我永远追求,对她我永不放弃) 的吧!
      

  2.   

    怎么不能用啊?你建添加一个BUTTON和EDIT(把Text中的内容清空)看看,然后用这个看看
    procedure TForm1.Button1Click(Sender: TObject);
    begin
       if Edit1.Text = '' then
          showmessage('123')
       else
          showmessage('456');
    end;
      

  3.   

    用 yhncom_36(事业我永远追求,对她我永不放弃) 的没错!
      

  4.   


     try    strtofloat(edit1.text)
     
     excepty   ................... end;
      

  5.   

    Edit1.Text = '' 写法会有错的,在text中输入个空格就不幸了
    还是要用yhncom_36(事业我永远追求,对她我永不放弃)的
    function Trim(const S: string): string;Trim removes leading and trailing spaces and control characters from the given string S.
      

  6.   

    可以用edit1.text=null 试试!
      

  7.   

    找出原因了,我用的是
    aa:=iif(trim(edit1.text)='',0,strtofloat(edit1.text))
    iif()函数判断trim(edit1.text)=''判断不出来,但用if then else语句是没问题的。大家看是不是!
      

  8.   

    用 yhncom_36(事业我永远追求,对她我永不放弃) 的肯定没错!