VB 2008 - Unselect a branch in Treeview

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
ljcorAsked:
Who is Participating?
 
Jorge PaulinoConnect With a Mentor IT Pro/DeveloperCommented:
You can use:

Me.TreeView1.SelectedNode = Nothing
0
 
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
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
 
ljcorAuthor Commented:
Two of the very best Experts helping this poor soul.  Thanks greatly!
Jack
0
All Courses

From novice to tech pro — start learning today.