private void button2_Click(object sender, EventArgs e) { try { this.Hide(); if (comboBox1.SelectedItem.ToString() == "System") { NewSystem newSystem = new NewSystem(tree); newSystem.ShowDialog(); } else if (comboBox1.SelectedItem.ToString() == "Sector") { NewSector newSector = new NewSector(tree); newSector.ShowDialog(); } else if (comboBox1.SelectedItem.ToString() == "Sector Object") { NewSectorObjectType newSectorObject = new NewSectorObjectType(tree, sw); newSectorObject.ShowDialog(); } this.Close(); } catch (Exception) { MessageBox.Show("Please Select an option from the dropdown menu."); } }