Question

I have a tree with multiple nodes with different depth. So I need to use the check boxes for deleting nodes not the selection method.

Was it helpful?

Solution

I have tried this code and it worked good, if anyone have a comment please come up with it.

    ArrayList checkedNodes = new ArrayList();

    if (elementsHierTree.CheckedNodes.Count != 0)
    {
        foreach (TreeNode nodee in elementsHierTree.CheckedNodes)
        {
            if (nodee.Parent != null)
            {
                checkedNodes.Add(nodee);
            }
        }
    }

    foreach (TreeNode chNode in checkedNodes)
    {
        chNode.Parent.ChildNodes.Remove(chNode);
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top