[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 533
  • Last Modified:

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?
0
Moed
Asked:
Moed
  • 2
1 Solution
 
ladarlingCommented:
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now