Alternative to listbox/listview
-
Hello I got a list of words I need to show the user of my application. The list is around 1000 words. I have tried to fill the words in both a listbox and a listview(with view set to detail and 1 columns) I have a button which refres the data in the list, simply by removing them all and then re-fill them, if the list isnt too long it doesnt bother the user, but if the list is 1000 lines (as in my situation) it takes too long time to enter all the data again. I thought there might be some alternative to listbox/listview which is made to handle alot of lines? Otherwise it is probably my code which is wrong, however i'm still in the beginnign phase :) To make an easy test I use this funktion (same for-loop to add data to the listview)
private void Test()
{
this.listBox1.Items.Clear();
for (int i = 0; i < 1000; i++)
this.listBox1.Items.Add(i);
}if anyone got something else I can look up in a book or on the internet to find another way to handle this I would be really happy.
-
Hello I got a list of words I need to show the user of my application. The list is around 1000 words. I have tried to fill the words in both a listbox and a listview(with view set to detail and 1 columns) I have a button which refres the data in the list, simply by removing them all and then re-fill them, if the list isnt too long it doesnt bother the user, but if the list is 1000 lines (as in my situation) it takes too long time to enter all the data again. I thought there might be some alternative to listbox/listview which is made to handle alot of lines? Otherwise it is probably my code which is wrong, however i'm still in the beginnign phase :) To make an easy test I use this funktion (same for-loop to add data to the listview)
private void Test()
{
this.listBox1.Items.Clear();
for (int i = 0; i < 1000; i++)
this.listBox1.Items.Add(i);
}if anyone got something else I can look up in a book or on the internet to find another way to handle this I would be really happy.
Hi, whenever you change a Control's property, it will recalculate itself, redo its layout, repaint itself, etc since it does not know in advance whether your change is just one of many, the only one or the last one. When you want to do a lot of changes, you should consider calling Control.SuspendLayout at the beginning, Control.ResumeLayout at the end of the massive change. (or maybe suspend, do a lot, resume, suspend, do another lot, resume, etc). Some Controls also offer an AddRange() method that acts like a "multiple add"; that too can result in speed ups (AFAIK it does not make sense to combine both suspend and addrange). Give it a try on whatever Control suits you most. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
-
Hi, whenever you change a Control's property, it will recalculate itself, redo its layout, repaint itself, etc since it does not know in advance whether your change is just one of many, the only one or the last one. When you want to do a lot of changes, you should consider calling Control.SuspendLayout at the beginning, Control.ResumeLayout at the end of the massive change. (or maybe suspend, do a lot, resume, suspend, do another lot, resume, etc). Some Controls also offer an AddRange() method that acts like a "multiple add"; that too can result in speed ups (AFAIK it does not make sense to combine both suspend and addrange). Give it a try on whatever Control suits you most. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google