private void createList() { if (comboboxes != null) { comboboxes.Clear(); } comboboxes = new List <ComboboxNew> { }; foreach (var item in namesArray) { var combobox = new ComboboxNew(withAdd); combobox.setName(item.ToString()); if (item is names.room) { combobox.SelectedIndexChanged += new EventHandler(Room_SelectedIndexChanged); } else if (item is names.wardrobe) { combobox.SelectedIndexChanged += new EventHandler(Wardrobe_SelectedIndexChanged); } comboboxes.Add(combobox); } }
private static void disposeCombobox(ComboboxNew combobox) { combobox.SelectedItem = null; combobox.Items.Clear(); }