AdvTree select all nodes programmatically

1k views Asked by At

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

1

There are 1 answers

0
f1wade On BEST ANSWER

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