Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delete child node from Treeview

Posted on 1999-01-18
1
Medium Priority
?
1,467 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 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…
Suggested Courses

618 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