TreeView need help

  • Thread starter Thread starter shoa
  • Start date Start date
S

shoa

Hello

I have a TreeView in my Window application. In that I have some nodes
(parent nodes), each parent node has some children. What I want is that when
I double click a node (either parent or children), I can print the Text of
that node. I have:

Private Sub TreeView1_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TreeView1.DoubleClick
Dim objTreeNode As TreeNode

objTreeNode = TreeView1.GetNodeAt(m_x, m_y)

If Not (objTreeNode Is Nothing) Then

Debug.WriteLine("You double clicked " & objTreeNode.Text)

End If

End Sub

However, by using this method, I can print a text for a parent node but not
for a child node. Coul you please help

Thanks

S.Hoa
 
If I understand your question/problem correctly, this works:

Private Sub TreeView1_DoubleClick(ByVal sender As Object, ByVal e
As System.EventArgs) Handles TreeView1.DoubleClick
Label1.Text = TreeView1.SelectedNode.Text
End Sub

John
 
For me, I got the text of the parent and the children. Hmmm... I'm
stumped. Hopefully someone else here can help?

John
 
Thank you for your help
It work. The problem here is in my code, there are two functions
TreeView1_DoubleClick
TreeView1_DoubleClick1

So I have to delete one
Regards
S.Hoa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top