Ensure SelectedNode is nothing before calling Clear method.
Code:
Public Shared Sub SmartClearNodes(ByVal t As TreeView)
t.BeginUpdate()
Try [b]
t.SelectedNode = Nothing [/b] ' this is it ;-)
t.Nodes.Clear()
Finally
t.EndUpdate()
End Try
End Sub
Where I found it: http://www.developerfusion.com/show/4477/
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.