Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have an ArrayList containing all selected TreeNodes in my TreeView. Now I want to delete them. How? I thought just using

For Each DummyNode In alNodes

Me.treDokumente.Nodes.Remove(DummyNode)

Next

would do it, but it doesn't. The first node is removed and then the error is something like "collection was modified; enumeration operation may not execute". Even after a alNodes.Reverse before doing it, the same error occured. Any suggestions?!

  • *Gurus*
Posted

Since you're enumerating your own collection not the actual nodes in the treeview, I'm wondering why this is happening. Have you tried using the Remove method of the nodes instead?

 

For Each DummyNode In alNodes
 DummyNode.Remove()
Next

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted

Thanks, but that doesn't work either.

 

I'm enumerationg my own collection because I had to create my own type because the base TreeView does not support multiple selection.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...