老师,
我改成下面的代码,选定的节点没有赋值“角色”,应该怎么改呢。
Dim tr1 As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim nd3 As WinForm.TreeNode = tr1.SelectedNode
Dim nd,nd1 As WinForm.TreeNode
nd = e.node
If nd.Nodes.Count > 0
For Each nd1 In nd.AllNodes
nd1.Checked = nd.Checked
e.node.DataRow("角色") = nd3.Name
Next
End If
If e.node.Checked = False
Do While nd.parentnode IsNot Nothing
nd = nd.parentnode
e.node.DataRow("角色") = nd3.Name
If nd.Nodes.Count > 0
For i As Integer = 0 To nd.Nodes.Count -1
If nd.Nodes(i).Checked = True
e.node.DataRow("角色") = nd3.Name
Exit Do
End If
If i = nd.Nodes.Count -1
nd.Checked = False
e.node.DataRow("角色") =nd3.Name
End If
Next
End If
Loop
Else
Do While nd.parentnode IsNot Nothing
nd = nd.parentnode
nd.Checked = True
e.node.DataRow("角色") =nd3.Name
Loop
End If
[此贴子已经被作者于2015/4/28 13:58:32编辑过]