0

I've been reviewing the documentation and reading posts on the subject but still have not found the answer

currentTREENODE = treeviewResults.TopNode


        For Each item As String In incomingList

            If treeviewResults.Nodes.ContainsKey(item) Then

                currentTREENODE = treeviewResults.Nodes.Find(item, True)(0)

            Else

                newNode = New TreeNode(item)
                newNode.Name = item

                currentTREENODE.Nodes.Add(newNode)

            End If

        Next

I was thinking at first that the Collection wasn't being updated immediately so I tried BeginUpdate() and EndUpdate(), Update(), Refresh() but this has not corrected the problem

mreinsmith
  • 154
  • 3
  • 14
  • What are you trying to do? You arent using `nextTREENODE` anywhere, just assigning it – Ňɏssa Pøngjǣrdenlarp Jul 28 '16 at 20:35
  • cleaned it up some more – mreinsmith Jul 28 '16 at 22:22
  • 1
    *What are you trying to do?* Its not going to do anything if the node already exists (the IF portion isnt needed). TopNode is the first visible node, not the root node, is that what you want? The key is not the same as the text, so it might look like it fails. – Ňɏssa Pøngjǣrdenlarp Jul 28 '16 at 23:50
  • I did not realize that containskey does not check child nodes. Do you see any reason why treeview.nodes.find(item,true) would not work to determine if a treenode already exists? – mreinsmith Jul 29 '16 at 00:43

1 Answers1

0

Treeview.nodes.find works best, now I just need to figure out how to do it with a partial name or wildcards

mreinsmith
  • 154
  • 3
  • 14