Solved

VB 2008  - Unselect a branch in Treeview

Posted on 2009-07-12
3
394 Views
Last Modified: 2012-06-21
When the Treeview branch is clicked it's color changes.  (See attachment)  After it returns back to the Treeview the color remains unchanged.  How can I unselect that branch so the color disappears?
treeview.JPG
0
Comment
Question by:ljcor
3 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 400 total points
ID: 24836088
You can use:

Me.TreeView1.SelectedNode = Nothing
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 100 total points
ID: 24836099
You used the phrase...   "After it returns back to the TreeView"  ...which implies that the TreeView is getting Focus.  When it does get focus again a node will be selected automatically.

To prevent this you could use jpaulino's snippet in the GotFocus() event:

    Private Sub TreeView1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.GotFocus
        TreeView1.SelectedNode = Nothing
    End Sub
0
 

Author Closing Comment

by:ljcor
ID: 31602630
Two of the very best Experts helping this poor soul.  Thanks greatly!
Jack
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio editor? 1 37
Close word object 13 38
vb.net 2 37
Write to file when application closes (by logoff) - VB.NET 1 13
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
A short film showing how OnPage and Connectwise integration works.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

943 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

10 Experts available now in Live!

Get 1:1 Help Now