Solved

VB 2008  - Unselect a branch in Treeview

Posted on 2009-07-12
3
402 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
[X]
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
3 Comments
 
LVL 48

Accepted Solution

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

Me.TreeView1.SelectedNode = Nothing
0
 
LVL 86

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Suggested Courses

623 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