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!
Printable View
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!
Be sure to change the keys to something unique.
VB Code:
Private Sub TreeView1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) Dim objNode As Node If Button = vbRightButton Then If (TreeView1.SelectedItem Is Nothing) Then ' Nothing selected - add to the root. Set objNode = TreeView1.Nodes.Add(, , "MustBeUnique", "[Change the Text]") Else ' A node was right clicked on - might as well add the node there. Set objNode = TreeView1.Nodes.Add(TreeView1.SelectedItem.Key, tvwChild, "UniqueKeyAgain", "[Child Node]") End If objNode.Selected = True TreeView1.StartLabelEdit End If End Sub