我有编辑控件EDIT1,EDIT2,EDIT3三个我要对它们像VB中一样用索引值操作,应如何实现?

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      aa : Array [0..2] of Tobject;
      I : Integer;
    begin
      aa[0] := Edit1;
      aa[1] := Edit2;
      aa[2] := Edit3;
      for i := 0 to high(aa) do
      begin
        showmessage(tedit(aa[i]).name);
      end;
    end;
      

  2.   

    for i:=0 to compopent.count
    if component[i] is tbutton then
    ......
      

  3.   

    也可以设置tag的
    标签可以用来选择控件操作
    用tag属性区分
      

  4.   

    我想樓主是要問delph是否可以和vb一樣有控件數组