Foxtable(狐表)用户栏目专家坐堂 → [求助]TreeView代码救助


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

主题:[求助]TreeView代码救助

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


加好友 发短信
等级:版主 帖子:5246 积分:33163 威望:0 精华:8 注册:2013/1/17 21:28:00
  发帖心情 Post By:2015/3/5 10:55:00 [显示全部帖子]

Dim nms As String() = {"牌号","母卷号","卷号"}  '指定生成目录树的各列
Dim qts As String() = {"'","'","'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
Dim trv As WinForm.TreeView = e.Sender
Dim flt As String
Dim nd As WinForm.TreeNode
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
If e.node.Text = "加载所有数据" Then
    For Each nd In trv.AllNodes
        If nd.Name <> e.Node.Name Then nd.Checked = False
    Next
    flt = "1=1"
Else
    For Each nd In trv.AllNodes
        If nd.Checked  Then
            trv.Nodes(0).Checked = False '最上面"加载所有数据" 选择框去掉
            Dim rts() As String = nd.FullPath.Split("\")
            Dim val As String = ""
            For i As Integer = 0 To rts.length - 1
                If val > "" Then
                    val = val & " And "
                End If
                val = val & nms(i) & " = " & qts(i) & rts(i) & qts(i)
            Next
            If flt > "" Then
                flt = flt & " Or (" & val & ")"
            Else
                flt = val
            End If
        End If
    Next
End If
If flt = "" Then
    flt = "1 = 1"
End If
If e.Form.Controls("CheckBox_仅显库存").checked=True Then
    Tables("工序合并表查询独立窗口_Table_工序合并表").Filter  = flt & " and [库存标记] = True"
Else Tables("工序合并表查询独立窗口_Table_工序合并表").Filter  = flt
End If

 回到顶部