|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
loading treeview dynamically is very slowlevel-1node gets expanded (for the first time). To set up the code below, I've added a single child node for each level-1node, just so that I can get the "+" and the capability to expand. So the first time I click on any level-1 node, it loads 30 child nodes. The problem is how slow this is. To me it should be almost instantaneous. It takes 2-3 seconds, which doesn't sound like much, but believe me, it's irritating. The scroll bar rolls down the screen. Once the nodes are populated, expanding and collapsing the parent node is suitably quick. Any ideas on at least making this appear quicker? ---------------- Private Sub myTreeView_AfterExpand(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles myTreeView.AfterExpand Dim classNode As TreeNode Dim testCtr As Integer If e.Node.Nodes.Count = 1 Then If e.Node.Text = e.Node.Nodes(0).Text Then e.Node.Nodes.Clear() For testCtr = 1 To 50 classNode = e.Node.Nodes.Add(testCtr.ToString) Next End If End If End Sub Bracket all adds with this:
myTreeView.BeginUpdate () .............. .............. myTreeView.EndUpdate () Ah, much better. Thanks!
Robinson wrote: Show quoteHide quote > Bracket all adds with this: > > myTreeView.BeginUpdate () > > ............. > ............. > > myTreeView.EndUpdate () cowznofsky ha scritto:
> Rather than load all my data into the treeview I am loading when a See if this improves (vb2005):> level-1node gets expanded (for the first time). > To set up the code below, I've added a single child node for each > level-1node, just so that I can get the "+" and the capability to > expand. > > > So the first time I click on any level-1 node, it loads 30 child nodes. > > The problem is how slow this is. Private Sub myTreeView_AfterExpand(ByVal sender As Object, _ ByVal e As System.Windows.Forms.TreeViewEventArgs) _ Handles MyTreeView.AfterExpand Dim testCtr As Integer Dim SubNodes As New List(Of TreeNode) If e.Node.Nodes.Count = 1 Then If e.Node.Text = e.Node.Nodes(0).Text Then e.Node.Nodes.Clear() For testCtr = 1 To 50 SubNodes.Add(New TreeNode(testCtr.ToString)) Next e.Node.Nodes.AddRange(SubNodes.ToArray) End If End If End Sub
Full Screen
connect vb app to sql 2005 express How do you translate your WinForms app? (outsourcing localization) how to make cookies into an array? edit text in file using streamreader and string.replace Can't Figure Out why this array is out of bounds now! Looking for a simple explanation of how to walk through a dataset in .net 2.0 Add a META line to an existing HTML doc programmatically Logic Troubles - reading in a difficult textfile problem with join() |
|||||||||||||||||||||||