var
  I: Integer;
begin
  for I := 1 to 100 do
    if FindComponent(Format('Edit%d', [I])) is TEdit then
      (FindComponent(Format('Edit%d', [I])) as TEdit).Text := '这是比较简单的一种方法';
end;

解决方案 »

  1.   

    test: array[1..100] of Tedit
    for i := 1 to 100
     Test[i] := Tedit.create(self);
    通过数组test[i]来操作.
      

  2.   

    for i:=0 to self.ControlCount-1 do
    begin
    if (self.Controls[i]) is tedit then
       (self.Controls[i] as tedit).Text :='1';
    end;
      

  3.   

    Delphi中没有控件数组。假设你要把100个Edit框清空,它们的Name分别是Edit1, Edit2, ...var i:integer;
    begin
     for i:=1 to 100 do
       if (FindComponent('Edit'+IntToStr(i) is TEdit) then
        (FindComponent('Edit'+IntToStr(i) as TEdit).text:='';
    end;
      

  4.   

    我的方法和 rocktan 相同:test: array[1..100] of Tedit
    for i := 1 to 100
     Test[i] := Tedit.create(self);
    通过数组test[i]来操作.
      

  5.   

    请教:
     那 控件的 TAG 属性是做什么用途????????、
      

  6.   

    tag属性是你可以自己给控件加标签。tag属性可以重复,全局不唯一。用法很多很灵活。
    例如你的100个Edit各有各的名字,而不是有规律的。你可以将同类的tag全都设为1,另一类的全都设为2,另一类....,你可以只将其中的某一类或几类或全部一起操作
    var i:integer;
    begin
     for i:=1 to self.ComponentCount-1 do
       if (self.Components[i] is TEdit) then
        if (self.Components[i] as TEdit).tag=1 then
         (self.Components[i] as TEdit).text:='My tag is 1';
    end;
      

  7.   

    Delphi中没有提供专用的控件数组,但是你可以自己定义:
    var
      // 定义动态数组
      MyArray: Array of TEdit; //在初始化的时候可以这样做
    var 
      i, j: Integer;
    begin
    //检查符合条件的Edit的个数
      j:= 0;
      for i:= 0 to self.ComponentCount - 1 do
        begin
          if (self.Components[i] is TEdit) then
            j:= j + 1;
        end;
    //设置动态数组的长度
      SetLength(MyArray, j);
      j:= 0;
    //为动态数组赋值  
      for i:= 0 to self.ComponentCount - 1 do
        begin
          if (self.Components[i] is TEdit) then
            begin
              MyArray[j]:= (self.Components[i] as TEdit);
              j:= j + 1;
            end;
        end;
    end;
    这样你就已经将所有的TEdit作为元素写入数组中了,以后的问题就是你将如何去使用该数组了,如果你使用了tag的话,可以将上面的“if (self.Components[i] is TEdit) then”改写为“if self.Components[i].tag = 你要求的数值 then”,这样就可以将所有符合条件的控件作为元素写入数组中了,以上内容仅供参考,呵呵