winforms - C# ComboBox change active status -
i have 5 combobox
controls , when item selected in combobox
1
, new list created in combobox
2
, , on down combobox
5
. need change active status according current selected item. items not selected way of selectedindexchanged
event in button click event handler. have been working on code have reached impasse. here code:
///////////combo1////////////////////// int selectedindex1 = combobox1.selectedindex; object selecteditem1 = combobox1.selecteditem; if (selecteditem1.tostring() == "computers") { selecteditem1 = "32"; request.categoryid = selecteditem1.tostring(); } ///////////combo2////////////////////// int selectedindex2 = combobox2.selectedindex; object selecteditem2 = combobox2.selecteditem; if (selecteditem2.tostring() == "laptop") { selecteditem2= "1772"; request.categoryid = selecteditem2.tostring(); }
the problem when not use combobox
2
selected item , not cancel combobox
1
selected item. need supersede previous combobox
selected item.
private void combobox1_selectedindexchanged(object sender, eventargs e) { object selecteditem1 = combobox1.selecteditem; combobox2.enabled = true; combobox3.enabled = false; combobox4.enabled = false; combobox5.enabled = false; if(selecteditem1.tostring() == "computers") { //update data source combobox2 relevant data "computers" } //remove data combobox3 4 , 5 witch disabled }
repeat idea rest.
Comments
Post a Comment