Duplicate DIsplay of Root Node in System.Windows.Forms.TreeView control

Chris Fleetwood 1 Reputation point
2021-11-22T15:01:23.683+00:00

Hello,

I'm hoping someone will be able to shed some light on this.

I'm encountering an issue in the TreeView control that is manifesting when I build an instance of a System.Windows.Forms.TreeView in MS Video Studio 2017.

Basically,, the first time it is built, everything looks as expected. However, when I rebuild it at a later time (e.g.. after an update), the root node display gets duplicated. Multiple updates result in the TreeView displaying increasing multiple root notes.

The nodes do cleared each time before the TreeView gets built and rebuilt ( e.g., MyTreeView.Nodes.Clear() ).

I was able to verify that the root nodes do not physically get duploiated. The number of nodes in the Package treeview (Nodes collection) remain the same (1) and when i click on the duplicated root nodes and fall into debug (via MyTreeView_AfterSelect event), I can tell from the tag ID/handle that it is in fact the same (single) root node. It's just being displayed twice in the visual aspect of the TreeView.

This tells me that there is a bug in the Treeview control itself. I have researched this issue online in the StackOverflow dev community (as well as in a few other places) and I have tried a number of suggestions/approaches to try to get around the problem. None have been successful.

Any suggestions/insights would, of course, be greatly appreciated. I am at a loss as to what to do next.

Regards,

Christopher H. Fleetwood
cfleetwood@smartstart.org

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,741 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.