2021年8月1日 星期日

VB.Net TreeView TreeNode


 

 Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated

        Dim t(13) As TreeNode

        Dim r = "0,1,2,3,4,5,6,7,8,9,10,11,12".Split(",")

        Dim rr = {"", "公司", "部門一", "部門二", "分部一", "分部二", "分部一", "分部二", "人員一", "人員二", "人員一", "人員二", "十二"}

        t(r(1)) = TreeView2.Nodes.Add(rr(1))

        For i = 2 To 12

            t(i) = t(i \ 2).Nodes.Add(rr(i))

        Next

        TreeView2.ExpandAll()

    End Sub

沒有留言: