?
Solved

Delete child node from Treeview

Posted on 1999-01-18
1
Medium Priority
?
1,492 Views
Last Modified: 2008-03-06
How can I delete easily all the child nodes of a given node?
I have tried something like this:
Set anyNode = myTree.Nodes(myIndex).Child
While anyNode.Children <> 0
  myTree.Nodes.Remove myTree.Nodes(myIndex).Child.Index)
Wend
0
Comment
Question by:pjroy
1 Comment
 
LVL 12

Accepted Solution

by:
jgv earned 40 total points
ID: 1469303
Your example works, but you are setting anyNode's index to the first child when it should be set to the parent node. It should read:

Set anyNode = myTree.Nodes(myIndex)
While anyNode.Children <> 0
  myTree.Nodes.Remove (myTree.Nodes(myIndex).Child.Index)
Wend
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month16 days, 2 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question