treeview add nodes

S

Serkan

i want to build a tree form look like
+XX
X1
X2
X3
+YY
Y1
Y2
Y3

i used some codes,

TreeView1.Nodes.Clear
TreeView1.Nodes.Add ([relative], [relationship], [key],
text, [image], [selectedimage])

but i didn't build that form :(

can you help me...¿


p.s.: i use treeview ActiveX control - version 6.0,
from "Control Toolbox"
 
H

Harald Staff

Sure:

Private Sub Btn1_Click()
Dim NodX As Node
Dim L As Long

With Treeview1
..Nodes.Clear
Set NodX = .Nodes.Add(, , "Root", "I am Root")
NodX.Expanded = True
Set NodX = Nothing

Set NodX = .Nodes.Add("Root", tvwChild, "XX", "Item XX")
Set NodX = Nothing

For L = 1 To 5
Set NodX = .Nodes.Add("XX", tvwChild, "X" & L, "Item X" & L)
Set NodX = Nothing
Next

Set NodX = .Nodes.Add("Root", tvwChild, "YY", "Item YY")
Set NodX = Nothing

For L = 1 To 5
Set NodX = .Nodes.Add("YY", tvwChild, "Y" & L, "Item Y" & L)
Set NodX = Nothing
Next

End With
End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please

"Serkan" <[email protected]> skrev i melding
i want to build a tree form look like
+XX
X1
X2
X3
+YY
Y1
Y2
Y3

i used some codes,

TreeView1.Nodes.Clear
TreeView1.Nodes.Add ([relative], [relationship], [key],
text, [image], [selectedimage])

but i didn't build that form :(

can you help me...¿


p.s.: i use treeview ActiveX control - version 6.0,
from "Control Toolbox"
 
K

keepitcool

note that Nodes.Clear can be VERY slow
performance may increase dramatically if replaced with a simple loop:

With treeview1.Nodes
For i = .Count To 0 Step -1
.Remove (i)
Next
End With




keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top