How to select one or more nodes using the treeview?
Att
Joel Vieira
Printable View
How to select one or more nodes using the treeview?
Att
Joel Vieira
With the standard .net treeview, you can't. I suspect it would not be very difficult to create the effect though....
Create a class level List(of Treenode) to hold to selected nodes collection,
If a node is clicked, check the control key using the Control.ModifierKeys property,
If control is not pressed, clear the selected nodes
If the control key is pressed, add the node to the selected nodes collection
Finally, handle the treeviews drawNode event and if the node being drawn is in the collection, draw it so it looks selected using the SystemColors.Highlight Property.
Also if you wanted to perform and action of the entire selection, (such as delete, copy, etc) you would perform the action to everything in the selected node collection.
I have only highlighted a method that could work, and I'm sure there are a number of details I did not mention, but if you give it a go, I'm sure there are people to help if you get stuck
kevin
I use objectlistview ... this has a treeview that supports columns and multi-select ... but it may be a little complex for a n00b... still worth the look though
Kris