0

I am working with a DataGridView and have a column of type DataGridViewComboBox and I have stumbled across a problem. Basically, depending on the value of the cell, i would like to set the .Items to a certain set of strings, but when the value is changed, i would like to change the .Items list. But with this, I will occasionally remove a string from the list that is currently being occupied by another DataGridViewCell, this changes all the values that were equal to the removed item, until i re-add it back to the list (after i have finished editing).

So basically, I am wondering if there is a way of hiding some of the items from the combo box Drop Down list, so that when a certain cell is selected, they can't choose an item that isn't allowed.

Thanks,

Lloyd

GWLlosa
  • 23,995
  • 17
  • 79
  • 116
Lloyd Powell
  • 18,270
  • 17
  • 87
  • 123

1 Answers1

2

Instead of databinding the entire column, databind each row's DataGridViewComboBoxCell individually. That way, you don't have .items from one row affecting .items from another row.

GWLlosa
  • 23,995
  • 17
  • 79
  • 116