How to: Bind a Windows Forms ComboBox or ListBox Control to Data
To bind a ComboBox or ListBox control
If you are binding to a table, set theDisplayMember property to the name of a column in the data source.
- or -
If you are binding to an IList, set the display member to a public property of the type in the list.
Private Sub BindComboBox() ComboBox1.DataSource = DataSet1.Tables("Suppliers") ComboBox1.DisplayMember = "ProductName" End Sub
If you are bound to a data source that does not implement the IBindingList interface, such as an ArrayList, the bound control's data will not be updated when the data source is updated. For example, if you have a combo box bound to an ArrayList and data is added to the ArrayList, these new items will not appear in the combo box. However, you can force the combo box to be updated by calling the SuspendBinding and ResumeBinding methods on the instance of the BindingContext class to which the control is bound.