I try to use remove or clear method, but VB always show compile error. Maybe I don't know how to use it. I wonder if anyone can help. Thx.
Best Regards,
Kevin Shen
Printable View
I try to use remove or clear method, but VB always show compile error. Maybe I don't know how to use it. I wonder if anyone can help. Thx.
Best Regards,
Kevin Shen
Treeview1.Nodes.Remove index
Index can be a actual number or the nodes key value
John G
I tried
Treeview1.Nodes.Remove index
Treeview1.Nodes.Remove keyvalue
it doesn't work, compiler show "expected: end of statement"
Thanks!
Best Regards,
Kevin Shen
private Sub Command1_Click()
Dim intX as Integer
With TreeView1
for intX = 0 to 10
.Nodes.Add , , "a" & intX, "a" & intX
next
End With
TreeView1.Nodes.Remove (2) 'the second node, which is "a1"
TreeView1.Nodes.Remove ("a9")
End Sub
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
You need to replace index with the number of the node you wish to delete or replace keyvalue with the nodes key you used at the time you created the node. Boith the examples below worked fine for me
TreeView1.Nodes.Remove 100 ' Remove node 100
Treeview1.Nodes.Remove "ApplX" ' Remove node called ApplX
John G