"Derek Hart" <derekmhart@newsgroup> wrote in message
news:eNuInfo5KHA.3184@newsgroup
> No idea how to do this. Have a treeview with lots of nodes. Need to loop
> through the nodes, and remove ones (that have a specific tag). That is
> easy. But I don't want to remove the nodes under the ones removed. I want
> them to "move up" a notch, and only get deleted if they have a specific
> tag. Help! So each node is looked at, but no child nodes are remove until
> it is their turn to be analyzed. Three loops.
First, create a List(Of TreeNode). Then loop the entire tree. When you find
nodes that you want to delete, add them to the list.
Next, iterate the list. The first thing you'll need to do is iterate the
children of the active item (third loop) and set their Parent to the Parent
of the active item. This moves them "up a notch." Once that's done, delete
the node.