Pergunta

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.

Foi útil?

Solução

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);
    }
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top