Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

C#: treeView1_AfterSelect

Posted on 2004-10-06
1
Medium Priority
?
1,432 Views
Last Modified: 2008-01-09
My goal is to select a node (clicking with my mouse), and depending which node I have selected, do something.  So far, I have populated a TreeView with nodes.

The code I imagine would be placed inside the AfterSelect Event Handler.

private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
{
  // In here I need to determine which node was selected (by clicking it with my mouse)

}

Please Help!
0
Comment
Question by:sbreen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 8

Accepted Solution

by:
Razzie_ earned 2000 total points
ID: 12237629
In your AfterSelect event use:

TreeNode selectedNode = treeView1.SelectedNode;
MessageBox.Show("Selected TreeNode: " + selectedNode.Text);

selectedNode will be the selected node.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question