Foxtable(狐表)用户栏目专家坐堂 → [求助]这个目录树怎样写代码


  共有4356人关注过本帖树形打印复制链接

主题:[求助]这个目录树怎样写代码

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2013/8/30 22:24:00 [显示全部帖子]

参考下面的代码,测试有效。

Dim trv As WinForm.TreeView = Forms("窗口1").Controls("TreeView1")
Dim dt As DataTable = DataTables("表B")

Dim nd As WinForm.TreeNode = Trv.Nodes.Add("目录","目录")

Dim vals As List(Of String) = dt.GetUniqueValues("[第三列] Is Not Null", "第三列")

For Each val As String In vals
    Dim md As WinForm.TreeNode = nd.Nodes.Add(val, val)  
    Dim arys As List(Of String()) = dt.GetUniqueValues("第三列 = '" & val & "'", "第一列", "第二列")
    For Each ary() As String In arys
        Dim s As String = "【" & ary(0) & "】"
        md.Nodes.Add(2 & ary(1), s & ary(1))
    Next
Next

 回到顶部