Search code examples
c#winformsdata-bindingcomboboxdatagridviewcolumn

How to bind DataGridViewColumn to comboBox?


I have dataGridView with many columns and rows.

Now I'd like to bind content of first column (text) to content of comboBox.

How can I do this?


Solution

  • You can set the datasource of combobox like this:

    private void BindComboBox()
    {
      comboBox1.DataSource = dataGridView.DataSource;
      comboBox1.DisplayMember = "The column Name you want to bind";
    }