Solved

C#: treeView1_AfterSelect

Posted on 2004-10-06
1
1,387 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 500 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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

831 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