控件数组的问题可以用下面的方法
var  i:integer;
begin
for i:=0 to form1.ComponentCount-1 do
  if (form1.Components[i] is TEdit) then
      (form1.components[i] as TEdit).text:=inttostr(i);
end;

解决方案 »

  1.   

    以下代码是根据条件,取数据库记录生成SPEEDBUTTON。希望对你有帮助。
    var
      MyB:array of TSpeedButton;
    begin
        Setlength(MyB,table1.RecordCount);
        table1.First;
        i:=0;
        while not(table1.eof) do
        begin
          if table1.FieldByName('parent').asinteger=0 then
          begin
           MyB[I]:=TSpeedButton.Create(self);
           MyB[I].Parent:=panel1;
           {加入位置及宽高控制如:myb[i].width:=40;}
           MyB[i].flat:=true;
           MyB[i].caption:=trim(table1.fieldbyname('caption').asstring
           Myb[i].onClick:=buttonclick;//按纽事件
           i:=i+1;
          end;
          table1.next;
        end;
    end;
      

  2.   

    再给你介绍一篇文件,下载其全文看看就明白了。
    http://www.computerworld.com.cn/99/tips/9904/041608_05.asp