Hi All,
I am using the following code to add a comboBox to gridview and when user selects a value in the comboBox dropdown, I am trying to remove the "selected value" so as to prevent the user from selecting it again. For example, if the user has selected "Option1" in the comboBox, I want to remove it so that Option doesn't appear in other comboBoxes.
It is working partially because the process completely removes the selected value even from the comboBox where it was first selected and then gives me the following error. Any thoughts on this? Thanks in advance!
namespace DataGridViewComboApplication
{
public partial class DataGridViewComboForm : Form
{
public DataGridViewComboForm()
{
InitializeComponent();
}
private void DataGridViewComboForm_Load(object sender, EventArgs e)
{
//Adding Test Combo
DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();
cmb.HeaderText = "Options";
cmb.Name = "Options";
cmb.Items.Add("Option1");
cmb.Items.Add("Option2");
cmb.Items.Add("UNKNOWN");
dataGridViewComboTrial.Columns.Add(cmb);
}
No comments:
Post a Comment