谢谢,最好有个例子

解决方案 »

  1.   

    with table1 do
    begin
      open;
      first;
      while not eof then
      begin
        ComboBox1.Items.Add(FieldByName('name').AsString);
        Next;
      end;
    end;
      

  2.   

    同意也可以用  For i := 0 to Table.RecordCount -1 do
      

  3.   

    怎样把表中的一个字段的全部值添加到combobox中?Reply:
    这种做法,通常用于用户编辑界面,在combobox中显示可供用户选择的数据,节省时间,也可实现数据的某种约束。方法(例如:进、销、存管理中,制作订单,combobox显示运输方式--空运、):1.combobox属性:comboboxlist
    2.将表中的一个字段的全部值combobox.item.add(adoquery1.fieldbyname('字段').asstring)
    3.combobox.itemindex:=0//获得运输方式
    procedure Get_Shipping;
    var temp_int:integer;
    begin
        try
             ...
             if temp_adoquery.eof:=false then
             begin
                combobox.item.clear;
                for temp_int:=1 to temp_adoquery.rdcount do
                begin                 combobox.item.add(adoquery1.fieldbyname('字段').asstring;
                     temp_adoquery.next;
                end;  
             end;
        finally
        end;  
    end;
      

  4.   

    如果要用dbcombobox那就 和
     MichealLee() 所讲的是一样的。
      

  5.   

    将一个字段的全部值(不同的,相同的不添加)添加的combobox, 
    with datamodule2.bumentable do
       begin
       active:=true;
       max:=datamodule2.bumentable.recordcount;
       for i:=0 to max-1 do
       begin
       bumenname1:=datamodule2.bumentable.fieldbyname('bumenname').asstring;
       combobox1.items.add(bumenname1);
       datamodule2.bumentable.next;
       end;
       active:=false;
      

  6.   

    我用了一下DBComboBox,发现听不灵活的,所以用了ComboBox,还是自己写代码随心所欲......
      

  7.   

    with table1 do
    begin
      open;
      first;
      while not eof then
      begin
        ComboBox1.Items.Add(FieldByName('name').AsString);
        Next;
      end;
    end;