以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]目录树级点代码  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=95880)

--  作者:pcxjxjhkw
--  发布时间:2017/2/7 18:14:00
--  [求助]目录树级点代码

以下代码主要目录获取各个节点的级点,但不能达能预期目的。求助!

 

        For Each nd As WinForm.TreeNode In tv.AllNodes
            Dim jm As String = Format(nd.Index + 1,"00")
            Do
                If nd.ParentNode Is Nothing Then
                    Exit Do
                Else
                    nd = nd.ParentNode
                    jm = Format(nd.Index + 1,"00") & "." & jm
                End If
            Loop
            MessageBox.Show(nd.Name & "|" & jm)

        Next


--  作者:有点色
--  发布时间:2017/2/7 18:30:00
--  

Dim tv As WinForm.TreeView = Forms("窗口1").Controls("TreeView1")
For Each nd As WinForm.TreeNode In tv.AllNodes
    Dim jm As String = Format(nd.Index + 1,"00")
    dim pnd as WinForm.TreeNode = nd
    Do
        If pnd.ParentNode Is Nothing Then
            Exit Do
        Else
            pnd = pnd.ParentNode
            jm = Format(pnd.Index + 1,"00") & "." & jm
        End If
    Loop
    output.show(nd.Text & "|" & jm)
   
Next


--  作者:pcxjxjhkw
--  发布时间:2017/2/7 20:28:00
--  
谢谢