private void channelRemoveMenu_Click(object sender, EventArgs e) { TreeNode node = vsCameraTree.SelectedNode; if (node == null || node.Parent == null) { return; } String selectedNode = node.Text; // ask before remove if (MessageBox.Show(this, "Do you want to remove \"" + selectedNode + "\"", "Remove Layout", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { vsCoreMonitor.DeleteChannel(selectedNode); TreeNode retNode = node.PrevVisibleNode; this.camerasNode.Nodes.Remove(node); retNode.EnsureVisible(); } }