I am using the following method when adding items to my ListView.
I’ve made sure to have the ListView double buffered and tried to optimize everything that I can think of – but no matter what I do the UI is sluggish when adding items rapidly.
I have had this problem for quite some time and scouted around trying to find a solution, but gave up each time because I just wasn’t able to fix it. This time I’m hoping to solve this problem. 🙂
I’ve though about maybe going with some custom solution? Are there any good ones that can handle “SPEED”? Or is there something I can do with my current code?
Method:
private void AddNewItemToListView(string gPR, string rank, string category, string name, string url, string email, string address, string phone, string metadesc, string metakeywords, string mobile, string numbofreviews, string rating, string facebook, string twitter, string googleplus, string linkedin, string sitemap, string siteage, string backlinks, string trafficvalue)
{
Invoke(new MethodInvoker(
delegate
{
string[] row1 = { url, urlSec, address, phone, metadesc, metakeywords, mob, REV, RT, gPR, FB, TW, googleplus, LI, ST, SA, BL, TV };
ListViewItem item = new ListViewItem();
flatListView1.Items.Add(name).SubItems.AddRange(row1);
}
));
}
Would you be able to use the ListView.SuspendLayout() method at the start of the work and then call ListView.ResumeLayout() at the finish? That would speed things up alot, I think. You could also try to resume at regular intervals to get some feedback. For instance by inserting the following code at the indicated position: