I have a CSV file with Hierarchal Data in it which I wish to display in a TreeView.

Each entry in the file has a key which links it to a Parent.

For example one Entry might have the Key D1 so I no that has to go under the parent which has the code D1

I have set up my own NodeKey property which stores the code

The problem is when I find the code which matches the NodeKey property I don't no how to add a new entry under The parent or child heading.

The following code is how I have tried to do it.


'Loops round the nodes within the treeview
If (cNode.NodeKey = nextParent) Then
sString = nextElement & " " & nextDesc
iRecord = cNode.Index

Try
Nextmode = TreeView1.Nodes(iRecord)

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

Does anybody have any ideas PLEASE. It been cause me a great Headache.

Thanks

Daniel