Foxtable(狐表)用户栏目专家坐堂 → [求助]多选目录树如果是三级节点代码要怎么写?


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

主题:[求助]多选目录树如果是三级节点代码要怎么写?

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


加好友 发短信
等级:小狐 帖子:344 积分:3475 威望:0 精华:0 注册:2015/8/16 19:06:00
  发帖心情 Post By:2019/2/22 12:32:00 [显示全部帖子]

有代码吗?发一下学习一下,也在为这个问题发烦

 回到顶部
帅哥哟,离线,有人找我吗?
happy_gile
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:344 积分:3475 威望:0 精华:0 注册:2015/8/16 19:06:00
  发帖心情 Post By:2019/2/22 14:46:00 [显示全部帖子]

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("users").Find("group = '" & nd1.Name & "' And 职务 Is Null")
ElseIf nd1.Level = 1 Then
    dr = DataTables("users").Find("group = '" & nd1.ParentNode.Name & "' And 职务 = '" & nd1.Name & "'")
ElseIf nd1.Level = 2 Then
    dr = DataTables("users").Find("group = '" & nd1.ParentNode.Name & "' And 职务 = '" & nd1.Name & "' and  name = '" & 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

 回到顶部