procedure TForm4.FormShow(Sender: TObject);
var i: integer;
 i1 :integer;
begin
 //-------------------- 1 -----------------------
ADOTable1.Connection := form1.ado;
ADOTable1.TableName := 'BasiItemMatter';
adotable1.Active :=  false;
adotable1.Filtered := false;
adotable1.Filter :=' 索引 ='+ QuotedStr(finstring) ;
adotable1.Filtered := true;
adotable1.Open ;//-------------------- 2 -----------------------
ADOTable2.Connection := form1.ado;
ADOTable2.TableName := 'Depict';
adotable2.Active :=  false;
adotable2.Filtered := false;//label1.Free ;
 for i:=0 to adotable1.RecordCount -1  do
   begin
    label1 := Tlabel.Create(self);
    combobox1 := Tcombobox.Create(self);
    label1.Tag := i;
    combobox1.tag :=i ;
    label1.Parent := LabelBox;
    combobox1.Parent  := labelbox;
    label1.AutoSize := false;
    label1.Width :=130;
    combobox1.Width :=190;
    label1.Height := 21;
    combobox1.Height  := 21;
    label1.Visible := true;
    combobox1.Visible := true;
    label1.Alignment := taRightJustify;
    label1.Layout := tlCenter;
    label1.Top := i*label1.Height -labelbox.HorzScrollBar.Position +10*i+20;
    combobox1.Top := i*combobox1.Height -labelbox.HorzScrollBar.Position +10*i+20;
    label1.Left :=10 ;
    combobox1.Left :=150;
    combobox1.OnChange := combobox1changeClick;  //处理事件
    combobox1.OnDblClick := combobox1dbclick;
    label1.Caption :=  adotable1.Fields[1].AsString ;
    //每次索引不一样需要在这里更改
    adotable2.Filter :=' 索引1 =' + QuotedStr(finstring) +
             'and'+' 索引2 =' + QuotedStr(label1.Caption) ;
    adotable2.Filtered := true;
    adotable2.Open ;    for  i1:=0 to adotable2.RecordCount -1 do
    begin
      combobox1.Items.Add(adotable2.Fields[3].AsString  );
      adotable2.Next ;
    end;
    adotable1.Next;
   end;
end;
//在这个事件力处理意义描述
procedure Tform4.combobox1DbClick(sender : tobject);
begin
   showmessage(inttostr(combobox1.tag));end;procedure Tform4.combobox1changeClick(sender : Tobject);
var
  i:integer;
  LabelString : string;
beginif (checkbox1.Checked )  then   //checkbox为true的时候执行
  begin
    adotable2.Active := false;
    adotable2.Filtered := true;
    //showmessage(inttostr(combobox1.tag));
    //判断输入的项目
    for  I := 0 to Self.ComponentCount-1  do
      begin
        if ((Self.Components[I]) is TLabel) then
          begin
            if ((Self.Components[I]) as TLabel).Tag = combobox1.tag -1 then
              labelstring:=((Self.Components[I]) as TLabel).Caption ;
          end;
    end;    adotable2.Filter :=' 索引1 =' + QuotedStr(finstring) +
             'and'+' 索引2 =' + QuotedStr(labelstring) ;
    adotable2.Filtered := true;
    adotable2.Open ;    for  i:=0 to adotable2.RecordCount -1 do
    begin
       if (adotable2.Fields[4].AsString <> '') then
          memo1.Lines.Add(adotable2.Fields[4].AsString );
          adotable2.Next ;
    end; end
 else if not(checkbox1.Checked ) then
 begin
    for  I := 0 to Self.ComponentCount-1  do
      begin
        if ((Self.Components[I]) is Tcombobox) then
          begin
            if ((Self.Components[I]) as Tcombobox).Tag = combobox1.tag-1 then
                if (form4.Components[i] as tCombobox).Text ='' then
                  exit
                else
                  memo1.Lines.add((form4.Components[i] as tCombobox).Text);
           end;
    end;
 end;end;为什么所有的combobox1的tag值都是一样的呀