Results 1 to 4 of 4

Thread: Need basic treeview help........

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    Need basic treeview help........

    Hey, this is my first post in a LONG time; however, I need some help using the treeview control. I don't want to do anything really advanced with it. I need to use it as a visual for a program I'm writing that will allow users to build a menu. They will type something like "Music" in a text box a click the "add" button. I then want to add that item to the treeview. I have been able to add items to the treeview, but not subitems. After main menu items have been added, I want the user to be able to select one of them in the treeview and then add subitems (one at at time) from another textbox and command button. This doesn't seem to be too difficult, but every treeview demo I've seen has been way to complex for my purposes. Any help on this is extremely appreciated. This is my first outing with the treeview control, so any recommendations are also appreciated.

    BTW: I'm using Visual Basic 6.0

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    If I understand what you want then all you need to do is this

    VB Code:
    1. Private Sub Command1_Click()
    2.  
    3.     TreeView1.Nodes.Add TreeView1.Nodes(TreeView1.SelectedItem.Index), tvwChild, Text1.Text, Text1.Text
    4.    
    5. End Sub

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    Key is not unique?

    Whenever I try to add a subitem, I get the error message "key is not unique to collection".

  4. #4

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