|
-
Aug 25th, 2006, 02:01 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] To insert nodes in treeview
CIAO
First I thank the members here for helping what I needed. I can put an image in a Treeview control.
Q. How can I put nodes (add nodes) in the treeview, I know about the node click event but on runtime there is no node. How can I put nodes there so there may be nodes on runtime?
Thanks in Advance
-
Aug 25th, 2006, 02:16 AM
#2
Hyperactive Member
Re: To insert nodes in treeview
You can add to the form open event
VB Code:
With TreeView
.Nodes.add , , "Node1","Node 1"
End with
HTH
-
Aug 25th, 2006, 02:23 AM
#3
Re: To insert nodes in treeview
how do you add "sub nodes"
My usual boring signature: Something
-
Aug 25th, 2006, 02:29 AM
#4
Re: To insert nodes in treeview
This adds 1 Root node, 3 Children nodes, and 2 more Children of the 3rd child. As you can see the relations are made with the KEY parameter, that specifies who will be the father of that child.
The last parameter (the number), is the image index in the imagelist. If you dont want to add images remove that last parameter, else add an imagelist with some images (this uses 2) and go to your Treeview properties and select the Imagelist to use.
VB Code:
Private Sub Form_Load()
With TreeView1
'Add the Root Node
.Nodes.Add , , "Root", "Root", 1
'3 sons of Root
.Nodes.Add "Root", tvwChild, "Children 1", "Children 1", 2
.Nodes.Add "Root", tvwChild, "Children 2", "Children 2", 2
.Nodes.Add "Root", tvwChild, "Children 3", "Children 3", 2
'2 sons of Children 3
.Nodes.Add "Children 3", tvwChild, "Children 4", "Children 2", 2
.Nodes.Add "Children 3", tvwChild, "Children 5", "Children 3", 2
End With
End Sub
-
Aug 29th, 2006, 01:44 AM
#5
Thread Starter
Hyperactive Member
Re: To insert nodes in treeview
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|