473,396 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Which node on the tree view was clicked?

Dan
Anyone have any code to place in this procedure to determine what node
on my tree view was clicked?

Private Sub TreeView1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles TreeView1.Click

End Sub

Thanks in advance.
Nov 20 '05 #1
3 1424
Hi Dan,

try

MsgBox(TreeView1.SelectedNode.Text)

you can return any of the node properties this way, not
just text.

Good luck,

Jason
On 17 Jul 2004 10:09:14 -0700, ko****@yahoo.com (Dan) wrote:
Anyone have any code to place in this procedure to determine what node
on my tree view was clicked?

Private Sub TreeView1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles TreeView1.Click

End Sub

Thanks in advance.


Nov 20 '05 #2
* ko****@yahoo.com (Dan) scripsit:
Anyone have any code to place in this procedure to determine what node
on my tree view was clicked?


\\\
Private Sub TreeView1_MouseUp( _
ByVal sender As Object, _
ByVal e As MouseEventArgs _
) Handles TreeView1.MouseUp
If e.Button = MouseButtons.Right Then
Dim n As TreeNode = Me.TreeView1.GetNodeAt(e.X, e.Y)
If Not n Is Nothing Then
Me.TreeView1.SelectedNode = n
Me.MenuItem1.Text = n.Text
Else
Me.MenuItem1.Text = "(no item selected)"
End If
Me.ContextMenu1.Show(Me.TreeView1, New Point(e.X, e.Y))
End If
End Sub
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
Dan
Thank you so much. I have discovered this code:

Private Sub TreeView1_AfterSelect_1(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles
TreeView1.AfterSelect
MsgBox(e.Node.ToString)
End Sub

From:

http://msdn.microsoft.com/library/de...iewcontrol.asp

It does the job. Thanks a bunch.

Dan
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Piet | last post by:
Hi there, I have managed to write a small java program that display an xml file in a JTree. This was achieved by defining a suitable tree model. THe program works...somehow. The nodes (elements...
3
by: Robert Oschler | last post by:
What's a good way to find a specific text node element in a web page's DOM tree? I thought of traversing each node but there has to be a faster way. Is there a "find text node by nodeValue"...
0
by: hzgt9b | last post by:
Using visual studio .NET 2003, VB: I'm experiencing an issue with a TreeView object when it gets focus - the first root node in the tree always gets selected when the control gets focus - even if...
3
by: Saradhi | last post by:
Hi All, Here I am facing a performance problem with the TreeView Node renaming. I am displaying a hierarchy Data in a treeview in my Windows C# Application. My tree view represents an...
3
by: Brian Henry | last post by:
If i already have a tree view created, and want to add another new node to it, how would i do so? Is there a way to throught tags or anything? like i have this RootNode | +-- Child 1 +--...
2
by: mcena | last post by:
I have searched extensively and found no solution for vb6. Am using Visual basic 6 treeview control. I notice that when I click a node, the next time I click on a different node the action of the...
1
by: R.A.F. | last post by:
Hi, I would like simulate a mouse click on on of my treeview nodes when my form opens. for that i was thinking to use the same simple way as under C++ : SendMessage(TreeView.Nodes.Handle,...
1
by: BeginingOfLife | last post by:
i am using a java script to create a tree view in my html page. i got that script from this link : http://destroydrop.com/javascripts/tree/ given script is static script creations for tree...
5
ram09
by: ram09 | last post by:
I had made a tree view of folders in a rad tree view... I have added a text box with a button in one of my nodes, using this code node.controls.add(txtbox) node.controls.add(btn) where, txtbox...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.