仅供参考:
procedure TForm1.Button1Click(Sender: TObject);
var
  i:integer;
begin
  for i:=0 to  ControlCount-1 do
    if Controls[i] is TLabel then
      Showmessage(Controls[i].Name);
end;

解决方案 »

  1.   

    TLabel *mylabel[10];
    TIniFile ini;
    ini=new TIniFile(ChangeFileExt(Application->ExeName,".INI"));
    for(i=0;i<count;i++)
    ini->WriteInterger("Form","Caption",mylabel[i]->Caption);
      

  2.   

    采用数据库储存label,是说自动识别表单上的label后自动存为数据库吗?
      

  3.   

    可以使用label 的 tag 属性。
      

  4.   

    有两种方法:
    1.控件数组:var
      Form1: TForm1;
      Button: array[0..2] of TButton;implementationuses hit,DdnSizerControl;{$R *.DFM}
    procedure TForm1.ButtonMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      if ssCtrl in Shift then
      begin
        ReleaseCapture;
        (Sender as TWinControl).Perform(WM_SysCommand, sc_DragMove, 0);
      end
      else
        frmHit.Show;
    end;procedure TForm1.FormCreate(Sender: TObject);
    var
      iCount: Integer;
    begin
      for iCount := 0 to 2 do
      begin
        Button[iCount] := TButton.Create(Self);
        Button[iCount].Caption := 'Button' + IntToStr(iCount);
        Button[iCount].Parent := Self;
        Button[iCount].Left := iCount * 10;
        Button[iCount].Top := iCount * 30;
        Button[iCount].OnMouseDown := ButtonMouseDown;
      end;end;2.FindComponent()方法获取控件
    如:
      TLabel(FindComponent('Label1').Caption := 'Find Label';
    帮助中的例子:
    procedure TForm1.Button1Click(Sender: TObject);var
      i: Integer;
    const
      NamePrefix = 'MyEdit';
    begin
      for i := 1 to 20 do begin
        TEdit.Create(Self).Name := NamePrefix + IntToStr(i);
        with TEdit(FindComponent(NamePrefix + IntToStr(i))) do
        begin
          Left := 10;
          Top := i * 20;
          Parent := self;
        end;
      end;
    end;
      
      

  5.   

    同意skimwater(掠水惊鸿) 
    用tag 属性比较灵活你只许判断tag 的值
      

  6.   

    大家都看错了,对不起可能是我的语言表达不成,我要的是提取数据库的内容然后更改label的caption
      

  7.   

    for i:=0 to componentcount-1 do
    begin
      if Components[i] is TLabel then
         if TLabel(components[i]).name='....' then
            TLabel(components[i]).caption:='......'
    end;
      

  8.   

    我来答:
    list:TList;
    procedure xx;
    var 
     tlbl:TLabel; 
     begin
    if list<>nil then
    list.free;
    list:=Tlist.Create;  
    while not table1.eof do
        begin
        tlbl:=TLabel.Create(self);
        tlbl.caption:=XXExchangetostr(table1.fieldbyName('xx'));
        list.additem(tlbl);
        table1.next;
        tlbl.free;
        end;
    end;
    在程序退出时别忘了释放list 哦!
    我现在心情不好(我在和情敌竞争)http://www.csdn.net/expert/topic/108/108760.shtm来给我出个主义吧!    
      

  9.   

    你的意思是Label的名称放在数据库中吗?
    可以这样实现:
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Table1.First;
      While not Table1.Eof do
      begin
        TLabel(FindCompoent(Tabel1.FieldbyName('LabelName'))).Caption := 'New Caption';
        Table1.Next;
      end; 
    end;
      

  10.   

    最好动态生成Label,因为窗体上的控件超过一定个数(好象是100多)后,程序就无法调试和运行。用数组动态生成Label,文件名也方便管理,效率又高。