我想要listbox的下拉表与数据库中的一张表相对应,
也就是说从预定的表里选择,该怎么做啊?

解决方案 »

  1.   

    要用ListBox就只能用代码实现
    比如:
    while not Dataset.eof do
    begin
      ListBox.items.add(Dataset.FieldByName('字段名').asstring);
      Dataset.next;
    end;
    如果只是用来查询,建议用DBComboBox或DBLookupComboBox
      

  2.   

    属性 ScrollBars :
    ssboth:都有
    ssHorizontal横向
    ssNone没有
    ssVertical 垂直
      

  3.   

    with adotable1 do 
    begin
      for i:=0 to RecordCount-1 do
        begin
         Listbox1.Items.Add(FieldByName('city_Name').AsString);
         Next;
        end;
    end
      

  4.   

    Select * from Table
    while not Table.eof do
    begin
      ListBox.items.add(Table.FieldByName('字段名').asstring);
      Table.next;
    end;