Hi,
I am trying to fill a treeview with dynamic data, without knowing the actual number of child nodes or levels at design stage - hence the structure of the tree. I have been searching this in various forums and did not see any answer addressing my problem in VB.NET. (The tree data is held in a 3 column table, namely "ID, Description, ParentID".)
I know you can create a tree by:
Since I do not know whether I have only one child or many grand grand ... grand childs during the coding, I can not setup a proper structure to fill the treeview. May be a recursive procedure is the solution but how?Code:TreeView1.Nodes.Add("abc") TreeView1.Node(x).Nodes.Add("child of abc") TreeView1.Node(x).Node(y).Nodes.Add("grand child abc") TreeView1.Node(x).Node(y).Node(z).Nodes.Add("grand grand child of abc")
Any help will be greatly appreciated..




Reply With Quote