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.
}
sqlCon.Close();
}


Mohammed Deeb HammoudehRank #1,485 · 1.1K reputationPosted Dec 20, 2016, 11:55 PM EST
Bineesh ViswanathRank #1,680 · 907 reputationPosted Dec 21, 2016, 1:21 AM EST
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Dec 21, 2016, 7:28 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Dec 21, 2016, 9:31 AM EST