I want to set the items of each DataGridViewComboBoxCell individually (beacause each combobox must have different items) in my DataGridView. I use this code to set the items:
foreach (DataGridViewRow row in grid.Rows)
{
((DataGridViewComboBoxCell)row.Cells[1]).Items.Clear();
foreach (Product prod in _ProductList)
{
((DataGridViewComboBoxCell)row.Cells[1]).Items.Add(prod.Name);
}
}
Debugging I see the items of the DataGridViewComboBoxCell is correctly set, but when I look at the grid, the combos are empty.
Making different tests I realized that if I set items after the form is loaded (in a click event for example) the items are shown normally.
What should I do to load the items at form load time?