Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27513

VS 2010 How to get node index of treeview branch

$
0
0
After searching most of the treeview node posts I have not been able to find the answer I am looking for.

I have a treeview loaded like the following example:
Parent1
Child1
GrandChild1
GreatGrandChild1
GreatGrandChild2
GreatGrandChild3
GrandChild2
GreatGrandChild1
GreatGrandChild2
Child2
GrandChild1
GreaGrandChild1
Parent2
Child1
GrandChild1
GreatGrandChild1
GreatGrandChild2
GreatGrandChild3
GrandChild2
GreatGrandChild1
GreatGrandChild2
Child2
GrandChild1
GreaGrandChild1

When I select a node I need to display data from a database>table> record specific to that node.

The database has four tables. Parent, Child, GrandChild and GreatGrandChild.

Each record in the Parent table has the following fields:
ParentNodeIdx, ParentData

Each record in the Child table has the following fields:
ParentNodeIdx, ChildNodeIdx, ChildData

Each record in the GrandChild table has the following fields:
ParentNodeIdx, ChildNodeIdx, GrandChildNodeIdx, GrandChildData

Each record in the GreatGrandChild table has the following fields:
ParentNodeIdx, ChildNodeIdx, GrandChildNodeIdx, GreatGrandChildNodeIdx, GreatGrandChildData

My problem is trying to figure out what the node indexes are for the Parent and Child Nodes when I mouse click on the GreatGrandChild node. I use the Treeview1.SelectedNode.Index to get the GreatGrandChildNode Index and the Treeview1.SelectededNode.Parent.Index to get the GrandChildnode index but can't figure out how to get the Child and Parent Node indexes.

Sorry for the long post but I tried to make my problem as clear as I could.

Thanks for any and all suggestions
Richard

Viewing all articles
Browse latest Browse all 27513

Trending Articles