以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  逻辑列的目录树。怎么filter  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=93732)

--  作者:yancheng
--  发布时间:2016/12/5 19:53:00
--  逻辑列的目录树。怎么filter
   Dim tv2 As WinForm.TreeView
    tv2 =e.Form.Controls("TreeView2")
    tv2.StopRedraw
    tv2.Nodes.Clear
    tv2.BuildTree(dt,"结帐|非活动|合同名称","","")
    tv2.Nodes.Insert("所有洽商",0)
    tv2.ResumeRedraw  
End If
上面的目录树:结帐,非活动。是逻辑列。(SQL外部数据)
在目录树显示时,显示的是:flase ture.(不是结帐)这种我应该怎么写生成树的代码?

Dim Filter As String
If e.node.Text = "所有洽商" Then
    Filter = ""
Else
    Dim dr As DataRow = e.Node.DataRow \'获取生成此节点的DataRow
    Select Case e.Node.Level
        Case 0
            Filter ="结帐 =\'" & dr("结帐") & "\'"
        Case 1
            Filter ="结帐 =\'" & dr("结帐") & "\' and 非活动 =\'" & dr("非活动") & "\' "
        Case 1
            Filter =" 结帐 =\'" & dr("结帐") & "\' and 非活动 =\'" & dr("非活动") & "\' and 合同名称 = \'" & dr("合同名称") & "\' "
    End Select
End If
DataTables("洽商汇总").LoadFilter = Filter
DataTables("洽商汇总").Load()

--  作者:有点蓝
--  发布时间:2016/12/5 20:46:00
--  
Dim tv2 As WinForm.TreeView
tv2 =e.Form.Controls("TreeView2")
tv2.StopRedraw
tv2.Nodes.Clear
tv2.BuildTree(dt,"结帐|非活动|合同名称","","")
For Each n1 As WinForm.TreeNode In tv2.Nodes
    If n1.Text.ToLower = "true" Then
        n1.Text = "已结帐"
    ElseIf n1.Text.ToLower = "false" Then
        n1.Text = "未结帐"
    End If
    For Each n1 As WinForm.TreeNode In n1.Nodes
        If n1.Text.ToLower = "true" Then
            n1.Text = "活动"
        ElseIf n1.Text.ToLower = "false" Then
            n1.Text = "非活动"
        End If
    Next
Next
tv2.Nodes.Insert("所有洽商",0)
tv2.ResumeRedraw

--  作者:yancheng
--  发布时间:2016/12/6 11:15:00
--  

AfterSelectNode下写:弹错:标准表达式中数据类型不匹配。


Dim Filter As String = ""
If e.node.Text = "所有洽商" Then
    Filter = ""
Else
    Dim dr As DataRow = e.Node.DataRow \'获取生成此节点的DataRow
    Select Case e.Node.Level
        Case 0
            Filter ="结帐 =\'" & dr("结帐") & "\'"
        Case 1
            Filter ="结帐 =\'" & dr("结帐") & "\' and 非活动 =\'" & dr("非活动") & "\' "
        Case 2
            Filter =" 结帐 =\'" & dr("结帐") & "\' and 非活动 =\'" & dr("非活动") & "\' and 合同名称 = \'" & dr("合同名称") & "\' "
    End Select
End If
DataTables("洽商汇总").LoadFilter = Filter
DataTables("洽商汇总").Load()

--  作者:有点蓝
--  发布时间:2016/12/6 11:23:00
--  
Filter ="结帐 =" & dr("结帐") 

逻辑列不要加引号,其它自己改改