我在多选目录树下设置一个textbox,用来显示多选目录树被勾选的节点(2级节点)名称。遇到一个问题,当把勾选的节点逐个清除时,直至清空,textbox显示的节点名称仍显示最后一个被清除的节点,没能清空,是哪里原因?
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 AndAlso nd.level = 1 Then
s = s & "," & nd.Text
If nd IsNot Nothing Then
e.Form.Controls("TextBox3").Value = s.trim(",")
Else
e.Form.Controls("TextBox3").Value =""
End If
End If
Next