C
Co
Hi All,
I want to be able to add a node to a treeview on the fly.
When I rightclick on a node in a treeview I want to add a new subnode
underneath the node I clicked.
I use following code to do so:
Private Sub TMenuClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.ToolStripItemClickedEventArgs)
'Point to menu item clicked in the Treeview
Select Case e.ClickedItem.Text
Case "Add Folder"
Dim sNewFolder = "Nieuwe Map"
Dim node = TreeView.SelectedNode
Dim nodeID = node.row("ID")
TreeView.Nodes.Add(sNewFolder)
TreeView.Refresh()
Case "Edit Folder" : MsgBox("Edit")
Case "Delete Folder" : MsgBox("Delete")
End Select
End Sub
What it does is create a new root node instead of underneath the
clicked node.
Also I want to be able to change the name from Nieuwe Map into
something else.
Like in windows explorer when you create a new Folder it stays
selected and you can change the name.
Marco
I want to be able to add a node to a treeview on the fly.
When I rightclick on a node in a treeview I want to add a new subnode
underneath the node I clicked.
I use following code to do so:
Private Sub TMenuClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.ToolStripItemClickedEventArgs)
'Point to menu item clicked in the Treeview
Select Case e.ClickedItem.Text
Case "Add Folder"
Dim sNewFolder = "Nieuwe Map"
Dim node = TreeView.SelectedNode
Dim nodeID = node.row("ID")
TreeView.Nodes.Add(sNewFolder)
TreeView.Refresh()
Case "Edit Folder" : MsgBox("Edit")
Case "Delete Folder" : MsgBox("Delete")
End Select
End Sub
What it does is create a new root node instead of underneath the
clicked node.
Also I want to be able to change the name from Nieuwe Map into
something else.
Like in windows explorer when you create a new Folder it stays
selected and you can change the name.
Marco