I was playing with the tree view control and found I can just populate all nodes of a tree view control and then assign a parent to each of them with another pass... You guys see any problem in that method?
I know there's a bunch of threads about this topic by @MajP, but this is likely a different method, I just want to know if you can foresee some problems with it. Tried with recursion, but I didn't like the experience, so I went with another route.
Should be simple, right?
I know there's a bunch of threads about this topic by @MajP, but this is likely a different method, I just want to know if you can foresee some problems with it. Tried with recursion, but I didn't like the experience, so I went with another route.
Code:
Function GrowTree(rs As Recordset, tvw As TreeView)
Do While Not rs.EOF
tvw.nodes.Add , , "k" & rs!division_id, rs!title
rs.MoveNext
Loop
rs.MoveFirst
Do While Not rs.EOF
If rs!parent_id <> 0 Then
Set tvw.nodes("k" & rs!division_id).parent = tvw.nodes("k" & rs!parent_id)
End If
rs.MoveNext
Loop
End Function
Should be simple, right?