Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
75
Selecting a tree's node in code
posted

I have a two Ultratree controls...the first tree control is on a form that is restricted in height and width.  So I have a popup component that floats over the form and the height and width is much bigger to all the user to see more detail of the data.  The goal is that when I select a node from the popup form is that it is transfered back to the original form.  I have an event that passes back the selectednodes collection.  I was trying to loop through the orignal tree and have not been able to find anything on how I would programically select the original tree with the same selection from the popup tree.

 

Thanks for any help on this

Public Sub SetSelectedNode(ByVal selectedNodes As SelectedNodesCollection)

    For Each node As UltraWinTree.UltraTreeNode In selectedNodes

        If node.Selected Then

            For Each treenode As UltraWinTree.UltraTreeNode In ResultsTree.Nodes

                If node.FullPath = treenode.FullPath Then 'NOTE problem with this is some node paths with the same name.

                   'ResultsTree.ActiveNode.Selected = True  'NOTE Doesn't work

                   'ResultsTree.Nodes.Item(treenode.Key).Selected = True  'NOTE not sure this work plus I don't have the key set and dont know how. 

                End If

            Next

       End If

   Next

 

End Sub

 

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

     

    rrober07 said:
    'ResultsTree.ActiveNode.Selected = True  'NOTE Doesn't work

    What exactly is not working? Is the Selected property not return true after you set it? 

    My guess is that your code is working fine, but you just don't see the selected nodes in the tree because the tree does not have focus. Try setting HideSelection on the tree to false or activating the tree control so that you can see the selection. 

Children