ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   treeview add nodes (https://www.excelbanter.com/excel-programming/278677-treeview-add-nodes.html)

Serkan[_2_]

treeview add nodes
 
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"

Harald Staff[_5_]

treeview add nodes
 
Su

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" 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"



Serkan[_2_]

treeview add nodes
 
thanks :),


-----Original Message-----
Su

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" 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"


.


keepITcool

treeview add nodes
 

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


"Serkan" wrote:

thanks :),


-----Original Message-----
Su

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

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




All times are GMT +1. The time now is 07:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com