Reputation: 5315
i want to select multiple node for a treeview using shiftkey as shown in below image
how to get the first clicked node index and then next clicked with shift key node index.
i have tried with below code snippet
Dim firstSelectedChildIndex As Integer = treeview1.selectedNode.Index
Dim lastSelectedChildIndex As Integer = treeview1.selectedNode.Index
Dim parentNodeIndex As Integer = treeview1.selectedNode.Parent.Index
Do
tvwAttributes.Nodes(parentNodeIndex).Nodes.Item(firstSelectedChildIndex).BackColor = Color.DodgerBlue
tvwAttributes.Nodes(parentNodeIndex).Nodes.Item(firstSelectedChildIndex).BackColor = Color.White
firstSelectedChildIndex += 1
Loop Until firstSelectedChildIndex = lastSelectedChildIndex
can i have any sample code or any clue how to do this?
Thanks in advance!!!!!
Upvotes: 0
Views: 4980
Reputation: 5315
Here is an article on how to do this.
Derive from base TreeView and enable multiple selection by overriding specific behaviors
Upvotes: 1
Reputation: 483
In VB.Net, TreeView
has a CheckBoxes
property, that creates a checkbox next to each node. You can use this for multiple select, but not Shift + Click I'm afraid.
Upvotes: 1