0
votes

I have a windows application where in one of the forms, I have two combo boxes. Both the combo boxes are filled with the same data. (e.g. A, B, and C as data items). The data comes from the database and is the bound to these combo boxes.

What I want is that if I select A in combo box 1, 'A' can not be selected in combo box 2 and vice versa. That is, same item can not be selected in both combo boxes unless there is only one item in the combo boxes.

Can anyone please guide me on how to achieve this ?

A pseudo code or a direction would be greatly appreciated.

Thanks.

1

1 Answers

0
votes

Maybe what you really want is to load the items into a list and keep that in memory instead of binding directly to the controls. Then you can use that list to dynamically (re)populate the ComboBox controls as selection events fire. Just wire up a SelectionChangeCommitted event to each one, and as they fire, (re)load the other ComboBox controls with the items that they should contain, either in complete or filtered by the item just selected.