private void deleteEntryToolStripMenuItem_Click(object sender, EventArgs e) { if (treEntries.Focused) { IEntry entry = (IEntry)treEntries.SelectedNode.Tag; if (MessageBox.Show("Are you sure you want to delete " + entry.Name + "?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (_fileAdapter.DeleteEntry(entry)) { _hasChanges = true; TreeNode nextNode = treEntries.SelectedNode.NextNode; UpdateEntries(); treEntries.Nodes.Remove(treEntries.FindNodeByIEntry(entry)); treEntries.SelectedNode = nextNode; } } } }