Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I clear the selection of a selected node in a TreeView? [closed]

Tags:

c#

winforms

How to deselect selected node (in after select event)?

like image 387
Marshall Avatar asked Aug 06 '12 07:08

Marshall


1 Answers

When you are faced with issues like this (dealing with what api you need to use) You should consult MSDN and then figure it out.

Now, see the TreeView page on msdn. It has a Selectednode property which says :

If no TreeNode is currently selected, the SelectedNode property is null.

Also, it has a getter and setter. So my best bet is:

myTreeView.SelectedNode = null;//will deselect it
like image 75
gideon Avatar answered Oct 01 '22 10:10

gideon