By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,556 Members | 1,479 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,556 IT Pros & Developers. It's quick & easy.

TreeView need help

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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

Nov 21 '05 #2

P: n/a
Using your method, I can get only the text of the parent node
S.Hoa

"johnb41" <or****@informatik.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
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

Nov 21 '05 #3

P: n/a
For me, I got the text of the parent and the children. Hmmm... I'm
stumped. Hopefully someone else here can help?

John

Nov 21 '05 #4

P: n/a
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
Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.