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
195
Wintree not being recursed correctly
posted

The below code used to work just fine as I recall. However, either I can't

get this to work correctly anymore due to a bug in my code or there's

something wrong with 11.1 UltraWinTree. Does this algorithm look right?


Thanks in advance, Don Bouchard


I'm calling this as follows:


utNodeFound = FindNode(utAccounts, nothing, "KEYDESIRED")



    Private Function FindNode(ByVal ut As UltraWinTree.UltraTreeByVal utNode As UltraWinTree.UltraTreeNodeByVal strKey As StringAs UltraTreeNode         Dim utNodes As TreeNodesCollection         ' If utNode is null, then assume we're starting at the top of the tree         ' otherwise, get this level's nodes and search them for a match         If utNode Is Nothing Then             utNodes = ut.Nodes         Else             utNodes = utNode.Nodes         End If         ' Now search in this level's nodes collection for a match         For Each utn As UltraTreeNode In utNodes             If String.Compare(utn.Key.Trim, strKey.Trim, True) = 0 Then                 Return utn             End If             If utn.HasNodes Then Return FindNode(ut, utn, strKey)         Next         Return Nothing     End Function