Loading a CSV file into a treeview is very slow
I have a CSV file with over 6000 records which I am loading into a TreeView cointrol. I use a recursive function to do this becuase I need to look for a key so I can identify where I need to place the entry in the TreeView
For Each sLine As String In UniclassBasic
iCount = iCount + 1
Dim sUniclassAray() As String = Split(sLine, ",")
If sUniclassAray(2) = "Uniclass" Then
sString = sUniclassAray(0) & " " & sUniclassAray(1)
Tree.Nodes.Add(New HalcrowTreeNode(sString, sUniclassAray(0)))
Else
Dim oNode As HalcrowTreeNode
'Call Recursive function
oNode = FindNode(sUniclassAray(2), Tree.Nodes)
If Not oNode Is Nothing Then
sString = sUniclassAray(0) & " " & sUniclassAray(1)
oNode.Nodes.Add(New HalcrowTreeNode(sString, sUniclassAray(0)))
End If
End If
Next
Does anybody have any ideas on where I can improve this code or would it be possible to use the old vb6 control within the Windows common Controls which worked pefectly or is this going to cause me problems furthur down the line.
Thanks in Advance
Daniel Barnes