winforms - remove item selected of first comboBox from second comboBox c# windows form application -
i having problem:
i making windows forms application in c#.
the problem i'm having have 4 comboboxes
, , when select item combobox1
item should removed combobox2
, combobox3
, combobox4
.
similarly, selected item combobox2
should removed combobox3
, combobox4
, , on.
i have tried can't head around it.
yep,
you should code in comboboxes selectedchange events:
private void combobox1_selectedindexchanged(object sender, eventargs e) { (int = 0; < combobox2.items.count; i++) { if (combobox2.items[i] == combobox1.selecteditem) { combobox2.items.remove(combobox2.items[i]); i--; } } }
it works if items string, if have custom object should cast items , compare specific property on them id example.
Comments
Post a Comment