Avuya Mxoli

Avuya Mxoli

  • NA
  • 236
  • 205.9k

Compare combobox items

Aug 20 2012 3:48 AM

Hi all,

I am working on a WPF C# app where I have two comboboxes and two listboxes. On load I populate both comboboxes with the same data. What I want to do on selection changed event of the first combobox is to compare the selected text with all the items in the 2nd combobox and when it is found it should be removed from the 2nd combobox because I am trying to avoid selecting the same record on both comboboxes. (The data in the comboboxes comes from the database).

This is the logic of what I want to do:
The comboboxes are loaded with teacher's names. So when I select a teacher on the 1st one, I then choose students on the 1st listbox and move them to the 2nd one where I also select a teacher on the 2nd combobox then I save the teacher in the 2nd combobox with the students in the 2nd listbox because I am exchanging students between these two teachers, that is why I dont want teacher "a" to be re-assigned to the same students because then there will have been no exchange done.


Answers (1)