elquixiote
Technical User
How to find a node given its key
Hi!
Is there a way to locate a node in treeview control for a given node.key?
I already accomplish that using the attached code, but couldn't it be a smarter, elegant efficient solution ?
nodePosition = 0
for i=1 to treeview1.nodes.count
if treeview1.nodes(i).key = TheKey then
nodePosition=i
exit for
endif
next i
if nodePosition=0 then
msgbox "Key doesn't exist"
else
msgbox "The key is in " & nodeposition
endif
Thanks,
ElQuijote
Hi!
Is there a way to locate a node in treeview control for a given node.key?
I already accomplish that using the attached code, but couldn't it be a smarter, elegant efficient solution ?
nodePosition = 0
for i=1 to treeview1.nodes.count
if treeview1.nodes(i).key = TheKey then
nodePosition=i
exit for
endif
next i
if nodePosition=0 then
msgbox "Key doesn't exist"
else
msgbox "The key is in " & nodeposition
endif
Thanks,
ElQuijote