我想把数据表中的某一字段中的值赋给ComboBox的下拉框中的值,不知如何赋值,我不想用DBLookupComboBox这个控件。

解决方案 »

  1.   

    其实DBLookupComboBox控件还是非常不错的!如何绑定,可以这样:
    ....
    if Length(ComboBox1.Items.Text)>0 then
      ComboBox1.Items.Clear;
    for i:=1 to Table1.RecordCount do 
      ComboBox1.Items.Add(Table1.FieldValues[SomeFieldValue]);
    ....
      

  2.   

    用dblookupcombobox比较好
    绑定的话,只要设置其listsource和listfield就可以了
      

  3.   

    用DBComboBox,然后将表中数据加进去
    如:
    DBComboBox1.Items.Clear;
    table1.first;
    while not table1.eof do
    begin
      DBComboBox1.Items.Add(Table1.FieldbyName9(fieldname).asstring);
      Table1.Next;
    end;
      

  4.   

    DBLookupComboBox不能输入,这一点很烦,而且限制死了,所以才不愿用,不知有没有直接把DBLookupComboBox的ListSource直接赋值给ComboBox的Items的方法?