Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 404
  • Last Modified:

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
0
ljcor
Asked:
ljcor
2 Solutions
 
jpaulinoCommented:
You can use:

Me.TreeView1.SelectedNode = Nothing
0
 
Mike TomlinsonMiddle 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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now