Solved

C#: treeView1_AfterSelect

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now