I am implementing the ability to cut/paste multiple nodes within a UltraWinTree. In order to do that, I need to save off the selectednodescollection to a an object. I know I can probably do this with multiple lines of code by either looping through the selectednodescollection or by using the array.copyto but why isn't it possible to convert the SelectedNodesCollection to TreeNodesCollection in one line of code. It doesn't make sense. I guess I just want confirmation if this insanity.
I can confirm that they are different types and that there is no way to "convert" one to the other. You are correct in your assumption that you can iterate them easily as they both have UltraTreeNode enumerators. I don't remember the reason why they are different types although the first thing that comes to mind is that the SelectedNodesCollection is used in the BeforeSelect event as well as the return type of the SelectedNodes collection, so it had different requirements than the TreeNodesCollection class.
Thanks Brian. I'm getting an "object reference not set to an instance" error trying to add to an instance of the Infragistics.Win.UltraWinTree.TreeNodesCollection. Note: I'm still trying to save off the e.NewSelections (SelectedNodesCollection) to a global variable for the purposes of comparing the last selection to the new selection and other needs.
Here is my sample code:
Dim MyCollection As UltraWinTree.TreeNodesCollection = Nothing Dim TempNode As New UltraWinTree.UltraTreeNode MyCollection.Add(TempNode) '<-- Object reference error.