Filled out a map from a hierarchical text file. The map contains the data of each record and its parent. I'm trying to build a TreeView, but I can't get any further than in the example. I understand that recursion is required, but I don’t understand how to do it. Please help.
Sub fillTree
For i = 1 To mf.Size
Dim r As record=mf.Get(i)
'If r.c1=0 Then
If r.parent = 0 Then
Dim ti As TreeItem
ti.Initialize("ti", r.c2)
Else if r.parent = 1 Then
Dim cti As TreeItem
cti.Initialize("cti", "My father " & ti.Text)
ti.Children.Add(cti)
Else
Dim dti As TreeItem
dti.Initialize("dti", "My brother " & cti.Text)
cti.Children.Add(dti)
End If
tv.Root.Children.Add(ti)
'End If
Next
End Sub