Treeview control problem

WebKill

Member
Joined
Apr 7, 2008
Messages
12
Programming Experience
Beginner
I have a treeview control that is being populated from a list of websites, I have it check through the sites and add the current site as a child node if it is a subsite and so on. The problem lies in that it keeps creating a new top level node over and over again unless the treeview control is hidden. For example I have two tabs, I put the treeview control on the second tab, then after it's done populating, it click the second tab and it is displayed properly. No code has changed, just the location of the treeview control. Why is this?

Here is the code, it loops through this till all the sites have been gone through, GetAllChildren takes a look at all the sites in the tereview to see if this one should be a child.

VB.NET:
Expand Collapse Copy
                    GetAllChildren(TreeView1.Nodes(0), subSites(i).Url.ToString)

                    If subSites(i).Title = "" Then
                        AddNode = NewNode.Nodes.Add(subSites(i).Url)
                    Else
                        AddNode = NewNode.Nodes.Add(subSites(i).Title)
                    End If

                    AddNode.Tag = subSites(i).Url
                    For j = 0 To lists.Count - 1
                        AddNode.Nodes.Add(lists(j).Title)
                    Next
 
Back
Top