Foxtable(狐表)用户栏目专家坐堂 → 想通过遍历目录树取对应表中列的值的问题?


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

主题:想通过遍历目录树取对应表中列的值的问题?

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/6/12 12:14:00 [显示全部帖子]

Dim nms As String() = {"短日期","起始时间","教室"} '指定生成目录树的各列
Dim qts As String() = {"'","'","'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
Dim trv As WinForm.TreeView = e.Sender
Dim flt As String
For Each nd In e.node.allNodes '清除子节点的选中标记
    nd.Checked = False
Next
nd = e.Node.ParentNode
Do While nd IsNot Nothing '清除父节点的选中标记
    nd.Checked = False
    nd = nd.ParentNode
Loop
For Each nd In trv.AllNodes
    If nd.Level > 0 Then
        If nd.Checked  Then
            Dim rts() As String = nd.FullPath.Split("\")
            Dim val As String = ""
            For i As Integer = 1 To rts.length - 1
                If val > "" Then
                    val = val & " And "
                End If
                val = val & nms(i-1) & " = " & qts(i-1) & rts(i) & qts(i-1)
            Next
            If flt > "" Then
                flt = flt & " Or (" & val & ")"
            Else
                flt = val
            End If
        End If
    End If
Next
msgbox(flt)

 回到顶部