Search code examples
c#.netdotnetbar

AdvTree select all nodes programmatically


I am trying to select all nodes on Ctrl + A on an AdvTree. it is set to allow multiselect.

I have the event PreviewKeyDown to check ctrl, and A are pressed.

I tried this:

For Each nd As Node In tvComputers.Nodes
    nd.SetSelectedCell(nd.Cells(0), Nothing)
Next

but its only selecting the last item in the tree, it doesnt seem to add to the selected list


Solution

  • Nevermind if found it, but thought ill put up for others to see as i couldn't find anywhere

     For Each nd As Node In tvComputers.Nodes
         tvComputers.SelectedNodes.Add(nd)
     Next