Results 1 to 2 of 2

Thread: Filling Treeview with unknown child levels

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2004
    Posts
    19

    Filling Treeview with unknown child levels

    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:
    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")
    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?

    Any help will be greatly appreciated..

  2. #2
    New Member
    Join Date
    Sep 2004
    Location
    Brisbane, Australia
    Posts
    3
    Have a look at the attached sample project to another person's problem... should help point you in the right direction.

    Hope this helps...
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width