for I := 1 to 4 do
begin
if Tedit(findcomponent('edit' +inttostr(i))).text = '' then
begin
showmessage('edit' + inttostr(i) 输入为空');
end;
end;
begin
if Tedit(findcomponent('edit' +inttostr(i))).text = '' then
begin
showmessage('edit' + inttostr(i) 输入为空');
end;
end;
var
i:integer;
begin
for i:=0 to componentcount-1 do
if components[i] is Tedit then
if Tedit(components[i]).text='' then
application.messagebox('文本框有空,不能保存!','不能保存!',mb_iconinformation+mb_ok);
end;
begin
if (components[i] is tedit) then
if (components[i] as tedit).text='' then
showmessage('edit' + inttostr(i) 输入为空');
end;
我解决问题时是一一添加的,但是在保存时想添加楼上的代码,应该放在什么地方?
if bool then begin //bool是再按"退出"按钮时不显示showmessage
if trim(sl_edt.text)='' then
begin
showmessage('你没有输入数量!!!');
sl_edt.SetFocus;
end;
end;
我保存的是向sql中保存,通过table1