I am using a Treeview for the first time and having trouble getting the value of the child node when I click.
I have a Treeview with a parent node "Archive" and several child nodes with the years 2015, 2016, 2017 etc.
I am able to retrieve the value of the node when I click but I don't want the value when I click the parent node "Archive"
I have a Treeview with a parent node "Archive" and several child nodes with the years 2015, 2016, 2017 etc.
Code:
Dim ExampleList = (From rw As DataRow In dt2.Rows
Where Not String.IsNullOrEmpty(rw.Item("Years"))
Select rw.Item("Years")
).ToList()
TreeView1.Nodes.Add("Archive")
For Each item In ExampleList
TreeView1.Nodes(0).Nodes.Add(item)
Next
Code:
Private Sub TreeView1_NodeMouseClick(sender As Object, e As TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseClick
MessageBox.Show(e.Node.Text)
End If
End Sub