基本逻辑问题,选了父子并不需要同时选。
Afterchecknode的事件代码改为:
Dim trv As WinForm.TreeView = e.sender
If e.node.ParentNode IsNot Nothing Then
e.node.ParentNode.Checked = False
End If
For Each nd As WinForm.TreeNode In e.node.Nodes
nd.Checked = False
Next
Dim s As String
For Each nd As WinForm.TreeNode In trv.Nodes(0).Nodes
Dim v As String = ""
If nd.Checked Then
v = nd.Text & "/all"
Else
For Each cd As WinForm.TreeNode In nd.Nodes
If cd.Checked Then
If v = "" Then
v = v & nd.Text & "/"
End If
v = v & cd.Text & ","
End If
Next
End If
If v > "" Then
If s > "" Then
s = s & vbcrlf
End If
s = s & v.Trim(",")
End If
Next
MessageBox.show(s)
[此贴子已经被作者于2015/6/12 9:24:31编辑过]