Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Clear all childs of treeview's nodes
Message
From
11/06/2002 03:01:54
 
 
To
10/06/2002 21:52:35
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00666759
Message ID:
00666817
Views:
17
If you need to remove all nodes, you can use:

ThisForm.TreeView1.object.Nodes.Clear

But if you want to remove only child nodes of particular node, you have two ways:
1. Remove node, which children you want to remove. This will remove all childrens. After that, add the same node at the same position.

NodeKey = ThisForm.TreeView1.object.Nodes("Parent").Key
NodeText = ThisForm.TreeView1.object.Nodes("Parent").Text
ThisForm.TreeView1.object.Nodes.Remove("Parent")
ThisForm.TreeView1.object.Nodes.Add(, , NodeKey, NodeText) &&If node was at root level

2. Remove all childrens with loop:

DO while !IsNull(thisform.TreeView1.OBJECT.Nodes("Parent").child)
thisform.olecontrol1.obJECT.Nodes.Remove(thisform.olecontrol1.obJECT.Nodes("Parent").child.Key)
enddo

Plamen Ivanov
MCSD .NET Early Achiever and MCAD .NET Charter Member (VB .NET/SQL Server 2000)
MCSD (VB 6.0/SQL Server 2000)

VB (.NET) - what other language do you need in the whole Universe?...

Previous
Reply
Map
View

Click here to load this message in the networking platform