Private Sub Form_Load()
'引用C:windowssystem32MSCOMCTL.OCX,否则提示出错。
Dim Rec As New ADODB.Recordset
Dim stRecQL As String
Dim Item As Integer
Dim i As Integer
Dim Node1 As Node
Rec.Open "GoodsCategoryQ", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
For i = 0 To Rec.RecordCount - 1
If Rec!P_ID = "S0000" Then
Set Node1 = Me.TreeView0.Nodes.Add(, , "S" & Rec!C_ID, Rec!CategoryLabel)
Else
Set Node1 = TreeView0.Nodes.Add("S" & Rec!P_ID, tvwChild, "S" & Rec!C_ID, Rec!CategoryLabel)
'Node1.Index = True
End If
Rec.MoveNext
Next
Rec.Close
End Sub
Private Sub Treeview0_NodeClick(ByVal Node As Object)
Me.L_Self.Caption = CStr(TreeView0.SelectedItem.index)
End Sub