Access Treeview树节点代码二
Posted 黑旗君
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Access Treeview树节点代码二相关的知识,希望对你有一定的参考价值。
Private Sub Form_Load()
‘引用C:\windows\system32\MSCOMCTL.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
以上是关于Access Treeview树节点代码二的主要内容,如果未能解决你的问题,请参考以下文章