Groups | Blog | Home
all groups > vb.net controls > october 2007 >

vb.net controls : using a treeview control in VB.net 2005


Brad Pears
10/12/2007 3:11:35 PM
I am attempting to use the treeview control in vb.net 2005. I can create the
parent and one levell down child nodes for that parent - but that seems to
be as far as I can get.

Can some one post some code for me that will add a parent-child-grandchild
to the tree??

I am looping through parent-child-grandparent relationships and am having a
hard time with the treeview syntax to create that type of structure.

Help!!

Below is very simple code to create a parent-child tree - but what do I need
to do to create a parent-child-grandchild??

Dim oNode As TreeNode

oNode = trvPostCalc.Nodes.Add("Parent")

oNode.Nodes.Add("Child")

' how do I create a child node of the above node (in essence a grandchild)

Thanks, Brad

yuichiro ochifuji
10/13/2007 12:00:00 AM
Hi,Brad.

[quoted text, click to view]
Dim ChildNode As TreeNode

[quoted text, click to view]
ChildNode=oNode.Nodes.Add("Child")

ChildNode.Nodes.Add("GrandChild")

Eric Moreau
10/13/2007 9:45:44 AM
Have a look at
http://www.emoreau.com/Entries/Articles/2006/04/The-Treeview-control.aspx
and
http://www.emoreau.com/Entries/Articles/2006/07/The-Treeview-control---Part-2.aspx

--


HTH

Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc. (http://www.emoreau.com)
Membre du réseau .NET Expertise www.dotnet-expertise.com


[quoted text, click to view]

AddThis Social Bookmark Button