TheSwamp

Code Red => .NET => Topic started by: latour_g on September 03, 2020, 04:18:16 PM

Title: Problem to fill DatagridviewComboBoxCell
Post by: latour_g on September 03, 2020, 04:18:16 PM
HI,

I have a treeview and a datagridview.  The datagridview is bind to a datatable and I have add a DataGridviewComboBoxCell.

When I check an item on my treeview, the datagridview is update.  It work fine except for the first item checked.

The DataGridviewComboBoxCell is not fill properly.  When I debug, I see that my list (lst in the code below) contains the correct value and it seem to add it correctly but it's not the case. 

The ComboboxCell will fill correctly for all the other item checked.  If I uncheck the first item and check again, the value in the combobox will be correct.

Code: [Select]
DataGridViewComboBoxCell dgvcbc = (DataGridViewComboBoxCell)dgvBlocs.Rows[nRow].Cells["Visibilité New"];                                               
dgvcbc.Items.Clear();
foreach (object itemToAdd in lst)
{
      dgvcbc.Items.Add(itemToAdd);
}

I'm lost on that one !

Thank you in advance