Results 1 to 7 of 7

Thread: [02/03] Treeview question

  1. #1

    Thread Starter
    Member infinisource's Avatar
    Join Date
    Oct 2005
    Location
    Lee's Summit, MO
    Posts
    60

    Question [02/03] Treeview question

    Can child nodes have child nodes under them as well?

    -Root
    ---|-Parent
    ------|-Child
    ---|-Parent
    ------|-Child
    --------|-Child

    Is this even possible?

  2. #2
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: [02/03] Treeview question

    Short answer... Yes.

    Is there anything about them that you're having trouble with? Keep in mind, the nodes can be both a parent and a child.

  3. #3

    Thread Starter
    Member infinisource's Avatar
    Join Date
    Oct 2005
    Location
    Lee's Summit, MO
    Posts
    60

    Re: [02/03] Treeview question

    Just trying to figure out how to add a child node to a child node... Would you know of any sample code that I could peek at?

  4. #4
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: [02/03] Treeview question

    This will add a node to each of the root:
    VB Code:
    1. For Each obj As System.Windows.Forms.TreeNode In Me.TreeView1.Nodes
    2.             obj.Nodes.Add(obj.Text & "'s Child")
    3.         Next obj
    Are you trying to find a specific one to add to?

  5. #5
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: [02/03] Treeview question

    If you need to search through and find the one, you can revise the sample I posted here:
    http://www.vbforums.com/showthread.php?t=394613

  6. #6

    Thread Starter
    Member infinisource's Avatar
    Join Date
    Oct 2005
    Location
    Lee's Summit, MO
    Posts
    60

    Re: [02/03] Treeview question

    Thanks for your reply... attached is an image of what I am trying to create...
    Attached Images Attached Images  

  7. #7
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [02/03] Treeview question

    Quote Originally Posted by infinisource
    Thanks for your reply... attached is an image of what I am trying to create...
    Hi,

    Go to the Nodes Collection and add a root, name it and you created your first Root (parent).

    Then click on that root and add a Child root, name it and you created a Child Root.

    If you click on that Child Root and add a Child again then you created a Child root in your first Child root.

    I hope it helps you,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

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