473,385 Members | 1,642 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,385 software developers and data experts.

C#- Tree Node Selection Event Handling

7
I would like to be able to get the text of the Node that was clicked. I tried this:


Expand|Select|Wrap|Line Numbers
  1. tree.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.openCompressorTabPage);
  2. ......................................
  3. private void openCompressorTabPage(object sender, EventArgs e)
  4. {
  5.    string name = (sender as TreeNode).Text
  6. }
No luck. MSDN has been of limited help, as has google for anything beyond a button sender.

Thanks in advance.
Oct 2 '08 #1
1 2217
Plater
7,872 Expert 4TB
Edit:
Well you are using the wrong eventhandler parameters for starters.
Expand|Select|Wrap|Line Numbers
  1. private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  2. {
  3.    string name=e.Node.Text 
  4. }
  5.  
MSDN would have told you exactly what you needed for that.
http://msdn.microsoft.com/en-us/libr...ck(VS.80).aspx

In fact, their example is like exactly what you are doing. You should check MSDN first before posting a question about something like this.
Oct 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Stephan Tobies | last post by:
Hi everyone, I am looking for a good data structure that could be used to represent families of trees with shared sub-trees and copy-on-write semantics. On a very abstract level, I would like...
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...
2
by: Jerry Langley | last post by:
Once a treeview node is selected how can I programmatically unselect it so that it might be selected again following the first selection if the user desires? The after selection event only fires...
2
by: dave.dolan | last post by:
I have generated a nice tree view that displays some otherwise cyptic XML in an easy to follow manner. The trouble is that the TreeView assumes that I'm wanting a link in each of the nodes, and I...
7
by: Adam Honek | last post by:
Hi all, How do we select a tree view's node outside of a tree view event? Looking through the lists there's no select function, the nearest I can find is GetNodeAt but this seems to want the...
6
by: Alan T | last post by:
Can I find out which node was right clicked on a treeview?
1
by: MrNobody | last post by:
by default when you right click a tree the control selects the node if you add a right-click event (so that I can put sepearate ContextMenus depending on what type of node the user clicked on)...
5
by: Jure Bogataj | last post by:
Hi all! I have a problem (performance issue) with listview. I have implemented an ItemSelectionChange on my listview and put some code in it (I build some toolbar based on selection and update...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.