主题:请教tree view与数据库问题
oxf9815
[专家分:0] 发布于 2005-10-24 00:11:00
请高手指点一下:
tree view与数据库问题
如我有表,字段ID值=11223344…
11为电影;22爱情片;33为影片“求求你表扬我”;44…
请教一下,我该怎么堆栈到tree view 控件中了?谢谢!
回复列表 (共2个回复)
沙发
singleminded [专家分:490] 发布于 2005-10-24 18:07:00
堆栈,我不知道怎么写不过用递归可以实现,
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Node As TreeNode
Dim str As String
str = TextBox1.Text
Node = TreeView1.Nodes.Add(str.Substring(0, 2))
Loadtree(Mid(str, 3), Node)
End Sub
Private Sub Loadtree(ByVal str As String, ByVal Node As TreeNode)
If str.Length >= 2 Then
Node = Node.Nodes.Add(str.Substring(0, 2))
Loadtree(Mid(str, 3), Node)
End If
End Sub
板凳
oxf9815 [专家分:0] 发布于 2005-10-24 23:21:00
谢谢,我先试试。不懂再请教你!
我来回复