Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


TreeView focus

Posted on 2004-10-30
Medium Priority
Last Modified: 2008-02-01
I have a problem.  I have a treeview on the left of my form and a tabcontrol with tabs on the right.  When I click on a Treeview node I am controlling behavior via the Treeview_AfterSelect.  This works great.  However, if I click on a node the "Treeview_AfterSelect" fires, then click on a tab in the Tabcontrol, then click the same node back in the Treeview, the "Treeview_AfterSelect" does not fire for a second time.  

How do I make this work?

Thank you very much,

Question by:rflaatten
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
LVL 86

Accepted Solution

Mike Tomlinson earned 500 total points
ID: 12453909
The simplest solution is to unselect the node after it has been selected.  Then when you click on it again, it will be reselected and the AfterSelect() event will fire:

    Private Sub TreeView1_AfterSelect1(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
        ' Do some stuff in here
        TreeView1.SelectedNode = Nothing
    End Sub


Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

596 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