以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]多选目录树勾选状态  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=110463)

--  作者:天一生水
--  发布时间:2017/12/3 20:59:00
--  [求助]多选目录树勾选状态

我在多选目录树下设置一个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


--  作者:有点甜
--  发布时间:2017/12/3 22:55:00
--  

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
    End If
Next

e.Form.Controls("TextBox3").Value = s.trim(",")