private void comboBox_SelectedIndexChanged(object sender, EventArgs e) { ComboBox comboBox = (ComboBox)sender; //string networkType = (string)comboBox.SelectedItem; if (selectedObj is Form) { ((Form)selectedObj).Hide(); } if (dictionary.TryGetValue((string)comboBox.SelectedItem, out selectedObj)) { if (selectedObj is Form) { ((Form)selectedObj).Show(); } } }