edit控件中的text属性,当没有任何值输入时,如何判断它的值是空的?
用edit1.text=''不行呀?edit1.text=null也不行?
因为我要用strtofloat(edit1.text),此函数在edit1.text为空时不正常,我需要提前判断,以避免此情况。
用edit1.text=''不行呀?edit1.text=null也不行?
因为我要用strtofloat(edit1.text),此函数在edit1.text为空时不正常,我需要提前判断,以避免此情况。
调试欢乐多
procedure TForm1.Button1Click(Sender: TObject);
begin
if Edit1.Text = '' then
showmessage('123')
else
showmessage('456');
end;
try strtofloat(edit1.text)
excepty ................... end;
还是要用yhncom_36(事业我永远追求,对她我永不放弃)的
function Trim(const S: string): string;Trim removes leading and trailing spaces and control characters from the given string S.
aa:=iif(trim(edit1.text)='',0,strtofloat(edit1.text))
iif()函数判断trim(edit1.text)=''判断不出来,但用if then else语句是没问题的。大家看是不是!