Bineesh  Viswanath

Bineesh Viswanath

  • NA
  • 1k
  • 764.5k

How to fill DataGridview comboBox cell with Db value

Dec 21 2016 3:38 AM
I am in a windows project  and have there abwork to fill comboBox control inside DataGridView.
I did some  coding for this, but not coming to the goal. 

if (dtbl.Rows.Count > 0)


foreach (DataRow row in dtbl.Rows)


DataGridViewComboBoxCell cbCell = (DataGridViewComboBoxCell)dgvLicenseMembers.Rows[0].Cells["dgvCmbNationality"];

cbCell.DataSource = dtbl;

cbCell.DisplayMember = "CountryName";

cbCell.ValueMember = "CountryID";

cbCell.Items.Add(row["CountryName"].ToString()); // ! Getting ERROR -Items collection cannot be modified when the DataSource property is set.





Answers (4)