此主题相关图片如下:目录树点击.gif
afterchecknode 事件代码
Dim trv1 As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim trv3 As WinForm.TreeView = e.Form.Controls("TreeView3")
Dim nd1 As WinForm.TreeNode = trv1.SelectedNode
Dim dr As DataRow
If e.node.ParentNode Is Nothing Then
If e.node.Checked = True Then
For Each cnd As winform.treenode In e.node.nodes
cnd.Checked =True
Next
Else
For Each cnd As winform.treenode In e.node.nodes
cnd.Checked = False
Next
End If
Else
e.node.ParentNode.checked = False
End If
'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 = 1 Then
dr = DataTables("授权").Find("name = '" & nd1.ParentNode.Name & "' And 表名 = '" & nd1.Name & "'")
End If
If dr IsNot Nothing Then
Dim nms As String
For Each nd As WinForm.TreeNode In trv3.AllNodes
If nd.Level > 0 Then
If nd.Checked Then
nms = nms & "," & nd.Name
End If
End If
Next
If nms > "" Then
dr("可编辑列") = nms.Trim(",")
Else
dr("可编辑列") = Nothing
End If
Else
MessageBox.show("授权表没有这列,请检查")
End If