Disabling A Form Element To Refresh? [duplicate]
Possible Duplicate:
.NET Listview Refresh
I'm adding 50k~ish items to a list view and it refreshes each time (this is slowing it down big time). How can I disable the redrawing of the form, and enable it when it's done adding all of the items?
How about adding it to a collection and binding this collection to the DataSource
property of the list control only once:
IList<Foo> items = FetchFoos();
myList.DataSource = items;
Of course if fetching 50k items is slow you might consider a BackgroundWorker to avoid freezing the UI (as a user I hate when my UI freezes).
精彩评论