The folowing code loops round looking for NodeKey to match the NextParent. Nodekey is a Key which I have setup for the Nodes Class

When it matches the key I wish to find the index of that key and then set the selected node to that index and create a new child underneath.

Unfortuently this code does not seem to work. Does anybody have any ideas.

'Loop Round tree View
If (cNode.NodeKey = nextParent) Then
sString = nextElement & " " & nextDesc
iRecord = cNode.Index

TreeView1.SelectedNode = TreeView1.Nodes(iRecord)
Nextmode = TreeView1.SelectedNode

NextMode.Nodes.Add(New HalcrowTreeNode(sString, nextElement))

End If

Thanks in Advance

Daniel