// Removes the selected country from the tree private void RmvCountryBtn_Click(object sender, EventArgs e) { if (CountryNameTB.Text.Length > 0) { try { CTree.RemoveItem(CTree.GetNodeByName(CountryNameTB.Text)); populateListView(""); if (CountryLV.Items.Count > 0) { GetCountryInfo(CountryLV.Items[0].Text); } else { resetCountryInfoFields(); } } catch (Exception ex) { Trace.WriteLine(ex); MessageBox.Show("Could not remove selected country", "Error", MessageBoxButtons.OK); } } else { MessageBox.Show("Please select a country first", "Error", MessageBoxButtons.OK); } }