Results 1 to 5 of 5

Thread: [RESOLVED] To insert nodes in treeview

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Posts
    275

    Resolved [RESOLVED] To insert nodes in treeview

    CIAO

    First I thank the members here for helping what I needed. I can put an image in a Treeview control.

    Q. How can I put nodes (add nodes) in the treeview, I know about the node click event but on runtime there is no node. How can I put nodes there so there may be nodes on runtime?

    Thanks in Advance

  2. #2
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    UK, Suffolk
    Posts
    319

    Re: To insert nodes in treeview

    You can add to the form open event

    VB Code:
    1. With TreeView
    2.             .Nodes.add , , "Node1","Node 1"
    3. End with

    HTH

  3. #3
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: To insert nodes in treeview

    how do you add "sub nodes"
    My usual boring signature: Something

  4. #4
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: To insert nodes in treeview

    This adds 1 Root node, 3 Children nodes, and 2 more Children of the 3rd child. As you can see the relations are made with the KEY parameter, that specifies who will be the father of that child.
    The last parameter (the number), is the image index in the imagelist. If you dont want to add images remove that last parameter, else add an imagelist with some images (this uses 2) and go to your Treeview properties and select the Imagelist to use.
    VB Code:
    1. Private Sub Form_Load()
    2.     With TreeView1
    3.         'Add the Root Node
    4.         .Nodes.Add , , "Root", "Root", 1
    5.         '3 sons of Root
    6.         .Nodes.Add "Root", tvwChild, "Children 1", "Children 1", 2
    7.         .Nodes.Add "Root", tvwChild, "Children 2", "Children 2", 2
    8.         .Nodes.Add "Root", tvwChild, "Children 3", "Children 3", 2
    9.         '2 sons of Children 3
    10.         .Nodes.Add "Children 3", tvwChild, "Children 4", "Children 2", 2
    11.         .Nodes.Add "Children 3", tvwChild, "Children 5", "Children 3", 2
    12.     End With
    13. End Sub

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Posts
    275

    Re: To insert nodes in treeview

    Thanks

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