Solved

Delete child node from Treeview

Posted on 1999-01-18
1
1,441 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
jgv earned 20 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

707 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