I need to loop through data and add nodes to an UltraTree object for each facility. But it fails when there are multiple records for a given facility.
System.ArgumentException: 'Key already exists, key: ts1'
So I'm trying to check the existing nodes and only add if it isn't already there.
'facNode is an UltraTreeNode
'nodeName is a string
If (facNode.Nodes.Contains(nodeName) = False) Then
Dim selectable = facNode.Nodes.Add(nodeName, "Study Director " & studyFacility.SMStudyDirectorName)
[Do Stuff]
End If
Unfortunately, facNode.Nodes.Contains(nodeName) always evaluates to false. Visual Studio says, "The expression causes side effects and will not be evaluated."
I've found many threads/articles that say each key must be unique, but I have not been able to find the proper syntax to check if a key already exists.