Windows Develop Bookmark and Share   
 index > Windows Forms General > Weird Treeview behavior when cleared
 

Weird Treeview behavior when cleared

Hi There,

working with a treeview, I need to refresh it when the value of another control changes. For that purpose, I clear it simply by MyTreeView.nodes.clear . Then, I repopulate it. However, though any intermediate check on the number of nodes shows that the number of nodes corresponds to my expectations, when the treeview is redisplayed, it has kept the whole history on display as if the clear would impact the counters, but not the actual contents...

(framework 2.0 SP1)

Any idea ?

forrest63  Tuesday, April 22, 2008 8:42 PM

Found the issue.

Since I develop in VB, I needed to pass a treenode to a function. However, I passed it by reference, rather than by value. It looks like internally I got a pointer of pointer rather than a simple pointer (which is one of the reasons why I am going to move to C# soon to have more direct control over pointers), causing duplicates. Though I am not exactly sure why duplicates appear, fixing the call by passing the treenode by value has fixedit.

forrest63  Wednesday, April 23, 2008 7:19 PM

Found the issue.

Since I develop in VB, I needed to pass a treenode to a function. However, I passed it by reference, rather than by value. It looks like internally I got a pointer of pointer rather than a simple pointer (which is one of the reasons why I am going to move to C# soon to have more direct control over pointers), causing duplicates. Though I am not exactly sure why duplicates appear, fixing the call by passing the treenode by value has fixedit.

forrest63  Wednesday, April 23, 2008 7:19 PM

You can use google to search for other answers

Custom Search

More Threads

• Change typed dataset datasource without rebuilding
• multiselection in a datagrid
• Crystal Report
• question about 3 separate toolstrip items added to ToolstripContainer.TopToolStripPanel
• Creating an Overtype Function
• Catch keydown values from a dialog form
• Accessing a DataRelation from a DataSet creating using Wizard
• Compact Framework Forms
• how to convert GB to bytes and MB to bytes
• Webbrowser Get Selected HTML