用数组、TList、或者TObjectList保存对象列表,然后用循环对每一个实例进行操作:for i:=0 to Count-1 // or T[Object]List.Count-1
begin
  Objs[i]....// or TMyObject(TTObjectList.Items[i])....
end;

解决方案 »

  1.   

    Delphi中没有VB那样的控件数组,宏替换是解释性的语言特有的东西,虽然好用,但效率比起编译性的语言相差甚远!
    JGTM2000说的办法就是很好的一种模拟的解决方式,是真正的Delphi。
      

  2.   

    在VC中也可同样处理呀,呵呵。
    完全同意JGTM2000,不过D5的列表释放好像有点问题,老死机。
      

  3.   

    看看你到底相干什么.procedure TForm1.Button5Click(Sender: TObject);
    var
      I: Integer;
    begin
      for I := 0 to ComponentCount - 1 do
      begin
        if Components[I] is TButton then
          ShowMessage('Button ' + IntToStr(I));
      end;
    end;
      

  4.   

    <B>To JGTM2000</B>
    请问怎样把字符串转换为控件.
    如:
    edit1:tedit;
    a:string;
    begin
    a:='edit1';
    能否已知a,而通过某种方法将a解释为edit1呢?