以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  目录树复选框问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=120712)

--  作者:douglas738888
--  发布时间:2018/6/22 11:34:00
--  目录树复选框问题

请教老师,下面代码能实现选择1个或多个复选框后,节点的String会填入到表A的列“范围”中,取消勾选,清除String

 

问题:现在想实现,勾选复选框后,把节点Level0 和Level1的字符填入到指定列中,应该怎样调整代码

 

例如:

目录树由表B的一级分类和二级分类生成目录树

目录树                                                            表A

+ A类                                                            范围                                                                    

        √A1                                                      A类:A1

        √A2                                                      A类:A2

+ B类                                                            B类:B2

          B1

        √B2

 

Dim trv As WinForm.TreeView = e.Sender
Dim flt As String
Dim r As Row = Tables("表A").Current
For Each nd As WinForm.TreeNode In e.node.Nodes 
    nd.Checked = False
Next
If e.node.ParentNode IsNot Nothing Then 
    e.node.ParentNode.Checked = False
End If
For Each nd As WinForm.TreeNode In trv.AllNodes
      If nd.Checked Then
        If flt > "" Then
            flt = flt & vbcrlf & vbcrlf 
        End If
        \'If nd.Level = 0 Then 
            flt = flt & nd.Text
        \'Else
            \'flt = flt & "( 一级分类 = \'" & nd.ParentNode.Text & "\' And 二级分类 = \'" & nd.Text & "\')"
        \'End If
    End If   
Next
r("范围") = flt


--  作者:有点甜
--  发布时间:2018/6/22 11:40:00
--  
Dim trv As WinForm.TreeView = e.Sender
Dim flt As String
Dim r As Row = Tables("表A").Current
For Each nd As WinForm.TreeNode In e.node.Nodes
    nd.Checked = False
Next
If e.node.ParentNode IsNot Nothing Then
    e.node.ParentNode.Checked = False
End If
For Each nd As WinForm.TreeNode In trv.AllNodes
    If nd.Checked Then
        If nd.Level = 1 Then
            flt = flt & nd.ParentNode.text & ":" & nd.Text  & vbcrlf
        End If
    End If
Next
r("范围") = flt
[此贴子已经被作者于2018/6/22 11:40:41编辑过]