views:

462

answers:

1

Hi,

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

+1  A: 

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
Brilliant, thanks for that, I should've thought about it more! it seems such an obvious solution!
ThePower