Results 1 to 2 of 2

Thread: Resolved!Help!TreeView

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2003
    Posts
    134

    Resolved!Help!TreeView

    Good Morning,

    I have been trying to look for a sample code for the past few days but there is no avail.... Anyone out there who know how to right click a treeview and add a folder(parent node)....


    Thanks!
    Last edited by pnutz; Sep 17th, 2003 at 03:10 AM.

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    Be sure to change the keys to something unique.

    VB Code:
    1. Private Sub TreeView1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    2.     Dim objNode As Node
    3.     If Button = vbRightButton Then
    4.         If (TreeView1.SelectedItem Is Nothing) Then
    5.             ' Nothing selected - add to the root.
    6.             Set objNode = TreeView1.Nodes.Add(, , "MustBeUnique", "[Change the Text]")
    7.         Else
    8.             ' A node was right clicked on - might as well add the node there.
    9.             Set objNode = TreeView1.Nodes.Add(TreeView1.SelectedItem.Key, tvwChild, "UniqueKeyAgain", "[Child Node]")
    10.         End If
    11.         objNode.Selected = True
    12.         TreeView1.StartLabelEdit
    13.     End If
    14. End Sub

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