Bullettime
This is probably one of the most asked questions in the history of programming i reckon!
Why does it take so long to load values into a treeview?
My query:
The following code starts the "BeginUpdate" method of me.Treeview1 then at the end I stop the update with the "EndUpdate" method
me.Treeview1.Nodes.Clear() ' Make sure there's nothing
me.Treeview1.BeginUpdate()
' This loop just loops out the records from my ds
For Each r In drData
Dim _Text as String = r("Description").ToString
Dim _Tag as String = r("ID").Tostring
Dim _Node as New Treenode
With _Node
.Text = _Text
.Tag = _Tag
End With
me.Treeview1.Nodes.Add(_Node)
Next r
me.Treeview1.EndUpdate
This bit of coding is relatively simple with a dataset containing max 400 entries, but as soon as I populate a dataset with values exceeding the 400 entry limit I'm faced with a delay of up to 10 minutes before the treeview actually displays anything, to be frank i'm populating a dataset with 20 000+ entries which needs to be listed in Treeview, categorized.
How can I posible speed up the display process of these values in the Treeview? Currently I have a Splashscreen that calls upon my form, populates the dataset and then the Treeview, but displaying the splashscreen to the users for about 10minutes isn't that feasible. Is there any way that I can speed up the Update process?
|