Results 1 to 3 of 3

Thread: [2005] Add child node in TreeView using the key;

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Thessaloniki ,Greece
    Posts
    100

    [2005] Add child node in TreeView using the key;

    I have one key of a node in a TreeView.

    How can I add a new child node under the node that it has this key?

    For example,

    Code:
    Dim tv As New TreeView
    
    tv.Nodes.Add("Key1", "Text1")
    tv.Nodes.Add("Key2", "Text2")
    tv.Nodes.Add("Key3", "Text3")
    To add some node undet the Key2 I have to write this.

    Code:
    tv.Nodes("Key2").Nodes.Add("Key2_1", "Text2_1")
    tv.Nodes("Key2").Nodes.Add("Key2_2", "Text2_2")
    But If I don't know the exactly level structure, how can I add a child node by knowing only the Parent Key.

  2. #2
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: [2005] Add child node in TreeView using the key;

    Look at the Find method in the Nodes property of the treeview.
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

  3. #3
    Member Dragokas's Avatar
    Join Date
    Aug 2015
    Location
    Ukraine on fire (country of slaves)
    Posts
    750

    Re: [2005] Add child node in TreeView using the key;

    -----
    Last edited by Dragokas; Jul 16th, 2018 at 12:47 PM. Reason: ---
    Malware analyst, VirusNet developer, HiJackThis+ author || my CodeBank works

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