Reputation: 55
I have a problem with DataGridViewComboBoxColumn. I have two of those and when I'm selecting something in one, then I would like to see only things which related to that one.
My code:
public Form1()
{
InitializeComponent();
List<string> contactNames = accountNamez.Select(s => (string)s).ToList();
dataGridView1.ColumnCount = 2;
dataGridView1.Columns[0].Name = "Product ID";
DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();
List<string> data = new List<string>();
foreach (var item in contactNames)
{
data.Add(item);
}
cmb.DataSource = data;
dataGridView1.Columns.Add(cmb);
//dataGridView1.Rows.Add(data);
DataGridViewComboBoxColumn cmb2 = new DataGridViewComboBoxColumn();
List<String> contacts2 = new List<String>();
cmb2.DataSource = data;
dataGridView1.Columns.Add(cmb2);e
}
Do I need to make some event handler? I'm new to it. I'm not sure how to make relations between two lists with DRVComboBoxColumn
.
Upvotes: 0
Views: 64