Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

C#: treeView1_AfterSelect

Posted on 2004-10-06
1
Medium Priority
?
1,451 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
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Integration Management Part 2
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…
Suggested Courses

886 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