Saint
Saint

Reputation: 5469

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?

Upvotes: 1

Views: 1115

Answers (1)

Zaheer Ahmed
Zaheer Ahmed

Reputation: 28548

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";
}

Upvotes: 3

Related Questions