下面带码可以,1是得出头节点,2是循环得下级节点,
Public Sub LoadModNodes(ByRef tvw As TreeView, strNode_Head As String)
Dim oCol As New cCollection
Dim oSysMgt As New SysMgt
Dim i As Integer
Dim oMod As cSysModule
'先加入没有上级部门的部门
Set oCol = oSysMgt.getSonModOfMod("0")
For i = 1 To getCollectionCount(oCol)
Set oMod = oCol.Item(i)
ObjToTree tvw, strNode_Head, strNode_Head & oMod.Mod_No, oMod.Name, "MOD", False
LoadSubModNodes tvw, oMod.Mod_No, strNode_Head
Next i
End Sub
Private Sub LoadSubModNodes(ByRef tvw As TreeView, strMod_no As String, strNode_Head As String)
Dim Nd1 As Node
Dim oCol As cCollection
Dim oSysMgt As New SysMgt
Dim i As Integer
Dim oMod As cSysModule
Dim iMax As Integer
Set oCol = New cCollection
Set oCol = oSysMgt.getSonModOfMod(strMod_no)
For i = 1 To getCollectionCount(oCol)
Set oMod = oCol.Item(i)
ObjToTree tvw, strNode_Head & strMod_no, strNode_Head & oMod.Mod_No, oMod.Name, "MOD", False
LoadSubModNodes tvw, oMod.Mod_No, strNode_Head
Next i
End Sub