Dim s As String
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
For Each nd As WinForm.TreeNode In trv.AllNodes
If nd.Checked Then \' 这个节点选中的话
Dim pd As WinForm.TreeNode = nd.ParentNode \'获取父节点
If pd IsNot Nothing Then \'有父节点
If pd.Checked = False Then \'父节点没有选中
s = s & "," & nd.name
End If
Else \'没有父节点
s = s & "," & nd.name
End If
End If
Next
e.Form.DropDownBox.Value = s.trim(",")
e.Form.DropDownBox.CloseDropdown