I have a WinForms TreeView with a vertical scroll bar. Sometimes I have to reset the nodes and fill the tree again. I do this in the middle of BeginUpdate/EndUpdate calls. But when I call Nodes.Clear(), the scroll bar is recalculated to account for the clearing of nodes, and after populating the Nodes and calling EndUpdate is recalculated again. This produces an ugly flickering.
treeView.BeginUpdate()
treeView.Nodes.Clear()
CreateNodes(treeView.Nodes)
treeView.EndUpdate()
I supposed calling BeginUpdate/EndUpdate prevented all repainting of the TreeView. The question then is whether my guess is wrong and this is not so, and in that case what whould be the solution.
(I´m using Visual Basic, .NET framework 4.6.1)