想更新label1-label400的caption为空,循环程序如下:
var i:integer;
w1,w2,w3:string;
begin
 for i:=1 to 400 do
 begin
  w1:='label';
  w2:=inttostr(i);
  w2:=w1+w2;
  w3:='.caption';
  w3:='';
 end;
end;
结果label的caption仍为原值,如何循环清空?请指教!
 
										
					
	非常感谢5楼的朋友的回答,真的解决了!真的好高兴!实实在在兴奋了一阵子~~~
但有一个限制条件,下面程序有效:
var
i:integer;
begin
 ADOTable1.TableName:='ybbb';
 ADOTable1.Active:=true;
     for i:=1 to 34 do
     begin
        tlabel(FindComponent('label'+inttostr(i))).Text :='';
     end;
   with adotable1 do
   begin
//其它命令行
end;
end;
下面程序无效:
var
i:integer;
begin
 ADOTable1.TableName:='ybbb';
 ADOTable1.Active:=true;
   with adotable1 do
   begin
     for i:=1 to 34 do
     begin
        tlabel(FindComponent('label'+inttostr(i))).Text :='';
     end;
end;
end;
即 放在 with adotable1 do begin end; 语句中间无效!之外有效!烦请再解决!真心感谢!
再给你个提示:
procedure TForm1.Button1Click(Sender: TObject);
 var
 i: integer;
 frmcomponent:Tcomponent;
begin
  for i:=0 to form1.ComponentCount-1 do
  begin
     frmcomponent:=form1.Components[i];
     if  ( frmcomponent is Tlabel) then
     (frmcomponent as Tlabel).Caption:='';
  end;
end;
end.
