locked
VS 2010 Combobox Not Populating Access Dropdown List Data RRS feed

  • Question

  • User-895457478 posted

    Hi,

    I am creating a simple Form in VS 2010 by using access database as backend source data.

    I dragged the access fields in the VS form, everything is fine but the drop down fields are just came as Text Fields instead of combobox.

    So I manually created a combobox by assigning that access table field source.  But after that also in preview (F5) the combobox comes as empty dropdown.  But access has the values for those combo box.

    Please let me know what I am doing wrong?  Or is there any workaround to arrive the dropdown list in VS form?

    Awaiting for the reply,

    ---

    VS

    Friday, August 14, 2015 1:38 AM

Answers

  • User-166373564 posted

    Hi,

    To  bind a ComboBox control, you can use code below:

    private void BindComboBox() 
    {
       comboBox1.set_DataSource(dataSet1.get_Tables().get_Item(
       "Suppliers"));
       comboBox1.set_DisplayMember("ProductName");
    }

    More information: Bind a Windows Forms ComboBox or ListBox Control to Data

    Please let me know if you need any help.

    With regards,

    Angie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 17, 2015 1:18 AM