Solved

TreeView focus

Posted on 2004-10-30
580 Views
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,

RFlaatten
0
Question by:rflaatten
    1 Comment
     
    LVL 85

    Accepted Solution

    by:
    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

    ~IM
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Cisco Complete Network Certification Training

    If you’re an IT engineer or technician, it's time you take your career to the next level. This elite training bundle is brimming with all of the information you need to learn to sit for Cisco CNNA, CCNP, and CCENT certification exams.

    1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    In this Experts Exchange video Micro Tutorial, I'm going to show how small business owners who use Google Apps can save money by setting up what is called a catch-all email address in their Gmail accounts. By using the catch-all feature, small busin…
    This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.

    856 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

    9 Experts available now in Live!

    Get 1:1 Help Now