以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  目录树清除父结点的问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=87683)

--  作者:凡夫俗子
--  发布时间:2016/7/16 23:01:00
--  目录树清除父结点的问题
目录树 如何写代码

当某子结点 选中时,清除其上级所有父结点的选中状态,可能一个,也可能多个

另如何 直接写 清除 0 层 0 结点 的选中状态 
[此贴子已经被作者于2016/7/16 23:06:27编辑过]

--  作者:狐狸爸爸
--  发布时间:2016/7/18 8:39:00
--  
 可以看看这个例子:
http://www.foxtable.com/webhelp/scr/2405.htm

其中有段代码就是您要的了:
Dim trv1 As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView2")
Dim nd1 As WinForm.TreeNode = trv1.SelectedNode
Dim dr As DataRow
If e.Node.ParentNode IsNot Nothing Then \'取消父节点的选中标记,因为选中子节点,就不要选中父节点了
    e.Node.ParentNode.Checked = False
End If
For Each cnd As WinForm.TreeNode In e.Node.Nodes \'取消子节点的选中标记,因为选中父节点,就不要选中子节点了
    cnd.Checked = False
Next
If nd1.Level = 0 Then
    dr = DataTables("授权").Find("分组 = \'" & nd1.Name & "\' And 权限 Is Null")
Else
    dr = DataTables("授权").Find("分组 = \'" & nd1.ParentNode.Name & "\' And 权限 = \'" & nd1.Name & "\'")
End If
If dr IsNot Nothing Then
    Dim nms As String
    For Each nd2 As WinForm.TreeNode In trv2.AllNodes
        If nd2.Checked  Then
            nms  = nms & "," &  nd2.Name
        End If
    Next
    If nms > "" Then
        dr("用户") = nms.Trim(",")
    Else
        dr("用户") = Nothing
    End If
End If


--  作者:凡夫俗子
--  发布时间:2016/7/18 14:21:00
--  
谢谢

如何 只循环 某一级 目录树

比如 只循环 第0级目录树,看是否有 空值 选项 ,如果有将其移动到最上面第二个的位置

--  作者:Hyphen
--  发布时间:2016/7/18 14:42:00
--  
http://www.foxtable.com/webhelp/scr/0907.htm