On May 15, 12:17 am, Marcolino <marco.pozzu...@gmail.comwrote:
Hi I have a little problem with Treeview expand.
So I'll try to explain.
I Have one node and some subnodes like this
+Nodes1
|------Subnodes 1
|------Subnodes 2
+Nodes2
|------Subnodes 3
|------Subnodes 3
and so on....
Well if Nodes2 is selected, and I'll click on + Nodes1,in the
AfterExpand and AfterCollapse event I'll got handle for Nodes2 (the
selected one) and not for the clicked one on + to expand.
I need to get the handle for node wich i clicked + and no the selected
one.
Is there a way to do what I need?
Many Thanks
Marcolino,
I tried to understand your issue and i hope adding these 2 events will
do what you want:
' Select node that's expanded
Private Sub TreeView1_AfterExpand(ByVal sender As System.Object, ByVal
e As System.Windows.Forms.TreeViewEventArgs) Handles
TreeView1.AfterExpand
TreeView1.SelectedNode = e.Node
End Sub
' Select node that's collapsed
Private Sub TreeView1_AfterCollapse(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles
TreeView1.AfterCollapse
TreeView1.SelectedNode = e.Node
End Sub
and TreeView1 is your TreeView control of course.
Hope this helps,
Onur Güzel