We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

delete multiple TreeNodes

I just found an example on how to inherit from TreeView to allow selection of multiple nodes. Everything works fine. Now I want to delete the selected nodes. Here's what I tried: for each DummyNode in TreDokumente.SelectedNodes TreDokumente.Nodes.Remove (DummyNode) next but that doesn't work. Any ideas how to do it?

1 Reply

AD Administrator Syncfusion Team October 23, 2002 11:49 PM UTC

> I just found an example on how to inherit from TreeView to allow selection of multiple nodes. Everything works fine. Now I want to delete the selected nodes. Here's what I tried: > > for each DummyNode in TreDokumente.SelectedNodes > TreDokumente.Nodes.Remove (DummyNode) > next > > but that doesn't work. Any ideas how to do it? Hi, The Nodes collection is not a single level one. Each node can then have its own collection like a true true. So, it must be that your selected nodes are not in the Nodes collection that you are trying to delete them from. You should do something like this. node.Parent.Nodes.Remove(node); Hope this helps. Daniel Syncfusion

Loader.
Up arrow icon