|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Multi-level TreeNode storing?I have a form that has six possible setups for a TreeView, though after
the Tree is shown, they all act the same way. The Nodes have three or four levels. Repopulating the tree for another setup takes a moment due to the logic involved in populating it. I am wondering it it would be faster if i could "save" the nodes for later. CopyTo and AddRange seem to support one level. Is there soimething similar for a multi-dimensional array? B. Brian Tkatch wrote:
> Repopulating the tree for another setup takes a moment due to the logic If your "setups" (like mine) involve different "arrangements" of the > involved in populating it. I am wondering it it would be faster if i > could "save" the nodes for later. same Nodes, then yes. Grab a reference, outside the TreeView, to each "group" node that you want to save, clear out the TreeView and rebuild the new structure, then add in the Nodes that you're holding, something like Dim oGroup1 As TreeNode = tv1.Nodes( 1 ) Dim oGroup2 As TreeNode = tv1.Nodes( 2 ) .. . . tv1.Nodes.Clear() .. . . Dim oNode As TreeNode _ = tv1.Nodes.Add( "Part 1" ) oNode.Nodes.Add( oGroup1 ) oNode = tv1.Nods.Add( "Part 2" ) oNode.Nodes.Add( oGroup2 ) HTH, Phill W. Phill W. wrote:
Show quoteHide quote > Brian Tkatch wrote: Thanx for the reply.> > > Repopulating the tree for another setup takes a moment due to the logic > > involved in populating it. I am wondering it it would be faster if i > > could "save" the nodes for later. > > If your "setups" (like mine) involve different "arrangements" of the > same Nodes, then yes. > Grab a reference, outside the TreeView, to each "group" node that you > want to save, clear out the TreeView and rebuild the new structure, then > add in the Nodes that you're holding, something like > > Dim oGroup1 As TreeNode = tv1.Nodes( 1 ) > Dim oGroup2 As TreeNode = tv1.Nodes( 2 ) > . . . > tv1.Nodes.Clear() > . . . > Dim oNode As TreeNode _ > = tv1.Nodes.Add( "Part 1" ) > oNode.Nodes.Add( oGroup1 ) > > oNode = tv1.Nods.Add( "Part 2" ) > oNode.Nodes.Add( oGroup2 ) > > HTH, > Phill W. Actually, it is the same data, but there are three different ways to show it, and each has two views based on a flag (thus showing different data, the two together are everything). Two of the three views add a newer top level, and do not show anything unless each has all three levels. The other one has three levels, but shows everything. So, i do not think your solution will work for me. I need to populate all six separately. B.
FileListBox from VB6?
Help with first VB application - Data Entry form Easy Value Compare Question MS VB Newbie Tutorial Check to see if a server is running Check if a Windows service running Dataset Writing to a file opened in another class CreateObject does not work consistently in X64 systems Me.Hide() |
|||||||||||||||||||||||