I have tree view which has grandfather node and inside of this grandfather there is parent and inside this parent there is son node. How I can get the names of this grandfather , parent and son nodes. I already did the code to work when the user double clicks on the son node, but still I am unable to get the names for the grandfather, parent and child nodes. here is my code:
Private Sub TreeView1_NodeMouseDoubleClick(sender As Object, e As TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseDoubleClick
Dim ClickPoint As Point = New Point(e.X, e.Y)
Dim ClickedChildNode As TreeNode = TreeView1.GetNodeAt(ClickPoint)
If ClickNode Is Nothing Then
Exit Sub
End If
Dim strGrandFatherName As String
Dim strParentName As String
Dim strSonName As String
strGrandFatherName = ?
strParentName = ?
strSonName = ?
dim nodes = e.Node.FullPath.Split(e.Node.TreeView.PathSeparator.ToCharArray())
.nodes(0)
is then the root of the current Node, etc.TreeView
, not theTreeNode
. That said, a reference to the node is provided ine.Node
, so the code used here to get the node that was clicked is pointless.