在sql库中有这样一个表
01 a
0101 aa
0102 ab
0103 ac
02 b
0201 ba
0202 bb
0203 bc
................................
怎么样能显示在treeview下实现这种效果:
a
-aa
-ab
-ac
b
-ba
-bb
-bc
...............................
我比较菜,希望大家能给我解释清楚一点,谢谢
...全文
825打赏收藏
treeview显示sql表数据的问题
在sql库中有这样一个表 01 a 0101 aa 0102 ab 0103 ac 02 b 0201 ba 0202 bb 0203 bc ................................ 怎么样能显示在treeview下实现这种效果: a -aa -ab -ac b -ba -bb -bc ............................... 我比较菜,希望大家能给我解释清楚一点,谢谢
Public Sub AddRootNode(ByRef tvwTemp As TreeView, _
ByVal strKey As String, _
ByVal strText As String, _
Optional ByVal strImage As String = "", _
Optional ByVal strSelectedImage As String = "")
Dim nodTemp As Node
If strImage <> "" Then
If strSelectedImage <> "" Then
Set nodTemp = tvwTemp.Nodes.Add(, , strKey, strText, strImage, strSelectedImage)
Else
Set nodTemp = tvwTemp.Nodes.Add(, , strKey, strText, strImage)
End If
Else
Set nodTemp = tvwTemp.Nodes.Add(, , strKey, strText)
End If
Set nodTemp = Nothing
End Sub
Public Sub AddChildNode(ByRef tvwTemp As TreeView, _
ByVal strParentKey As String, _
ByVal strKey As String, _
ByVal strText As String, _
Optional ByVal strImage As String = "", _
Optional ByVal strSelectedImage As String = "")
On Error Resume Next
Dim nodTemp As Node
If strImage <> "" Then
If strSelectedImage <> "" Then
Set nodTemp = tvwTemp.Nodes.Add(strParentKey, tvwChild, strKey, strText, strImage, strSelectedImage)
Else
Set nodTemp = tvwTemp.Nodes.Add(strParentKey, tvwChild, strKey, strText, strImage)
End If
Else
Set nodTemp = tvwTemp.Nodes.Add(strParentKey, tvwChild, strKey, strText)
End If