I have a table with the structure COMPANY(company_ID, company_name, parent_company_ID). In case, parent_company_ID is the Parent ID of the company (all parent and sub-company are stored in COMPANY table). I want to show the structure of company on the treeview (may be a lot of node level). I have ran these codes:
Code:
Dim rd As SqlClient.SqlDataReader = get_recordset("SELECT * FROM company ORDER BY company_ID")
        While rd.Read
            If rd("parent_company_ID") = 0 Then 'root level
                Dim nd As System.Windows.Forms.TreeNode
                nd = tv.Nodes.Add(rd("company_name"))
                nd.Tag = rd("company_ID")
            Else
                For Each nod As TreeNode In tv.Nodes
                    If nod.Tag.ToString = rd("parent_company_ID").ToString Then
                        Dim nd As System.Windows.Forms.TreeNode = nod.Nodes.Add(rd("company_name"))                        
                        nd.Tag = rd("company_ID")
                        Exit For
                    End If
                Next nod
            End If
        End While
But I 've got a treeview with two level (with company belongs to more than 3 level, they can not appearance on the treeview)

Does anyone help me to populate the treeview on this case?

Regards,
Hai