选择目录树父节点或子节点后,在用户单元格全部用户都写到里面去了,我想要的是左边选择了新用户,右边目录树勾选授权后,用户里面的数据能更新,现在是不管别的用户的这个节点有没有进行勾选授权,只要其中有一个用户勾选了,所有的用户都会勾选,不能判断原来有哪些用户是勾选了这个节点,再将这个用户的名字加进去
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 nd2 As WinForm.TreeNode = trv2.SelectedNode
Dim dr As DataRow
Dim sl As Integer
If nd2.Level = 0 Then
dr = DataTables("用户_授权").Find("父节点 = '"& e.Node.Name &"'")
ElseIf nd2.Level = 1 Then
dr = DataTables("用户_授权").Find("父节点 = '"& e.Node.ParentNode.Name &"' and 子节点 = '"& e.Node.Name &"'")
End If
If dr IsNot Nothing Then
Dim nms As String
If e.Node.Level = 0 Then
For Each yh1 As WinForm.TreeNode In trv1.Nodes
If nd2.Checked = True
nms = nms & "," & yh1.Name
End If
If nms > "" Then
dr("用户") = nms.Trim(",")
Else
dr("用户") = Nothing
End If
Next
ElseIf e.Node.Level = 1 Then
For Each yh1 As WinForm.TreeNode In trv1.Nodes
If nd2.Checked = True
nms = nms & "," & yh1.Name
End If
If nms > "" Then
dr("用户") = nms.Trim(",")
Else
dr("用户") = Nothing
End If
Next
End If
End If