Unique key for tree nodes

I use an infragistics tree control and each node requires a unique key.  If a key is not provided it uses the node text which rapidly causes and exception.  What is the best way to create a key the will always be unique?
LVL 2
MoedAsked:
Who is Participating?
 
ladarlingConnect With a Mentor Commented:
Why not just sequence them in the order that they are added to the tree? That is, you could just declare:
Dim currentNodeID as Integer
....
Tree1.Nodes.Add(currentNodeID)
NodeID +=1
Of course, that strategy may not work if you need to reference a node by ID without knowing the chronology of the adds. If that is likely, you may need to designate your own numbering scheme (much like a document outline.... roman numerals, with decimal children, which have alphabetic sub-children, and so forth).
0
 
ladarlingCommented:
Oops.. that would be
currentNodeID +=1
 
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.