void remove() { if (iniSectionTreeView.Nodes.Count > 0) { if (iniSectionTreeView.SelectedNode != null) { DialogResult dr = MessageBox.Show(String.Format("Are you sure you'd like to delete the item '{0}'?", iniSectionTreeView.SelectedNode.Text), "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question); switch (dr) { case (DialogResult.Yes): ExtendedTreeNode selected = (ExtendedTreeNode)iniSectionTreeView.SelectedNode; switch (selected.GetIntegerType()) { case (0): DialogResult drt = MessageBox.Show("This will delete all keys within this section. This cannot be undone. Proceed?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); switch (drt) { case (DialogResult.Yes): IniFile.IniSection section = ini.GetSection(selected.Text); ini.RemoveSection(section); selected.Remove(); changed = true; break; case (DialogResult.No): break; } break; case (1): IniFile.IniSection sectionn = ini.GetSection(selected.Parent.Text); sectionn.RemoveKey(selected.Text); selected.Remove(); changed = true; break; case (2): break; } break; case (DialogResult.No): break; } } } }