This is my first time here, and I'm struggling to solve this problem. I have this piece of code:
try { progressBar1.Maximum = lista.Items.Count; lista.BeginUpdate(); for (int i = 0; lista.Items.Count > i; i++) //for (int i = lista.Items.Count - 1; -1 < i; i--) { if (lista.Items[i].SubItems[1].Text.ToLower().Contains(Text) == false) { lista.Items[i].Remove(); } progressBar1.Value = progressBar1.Value + 1; } lista.EndUpdate(); progressBar1.Value = 0; } catch (Exception errore) { txt_info.Text = "" + errore.Message; progressBar1.Value = 0; }
The lista.items[i].remove extremely slow. lista is a ListView , and I'm working on a log file larger than 50,000 lines. Is there a way to speed up the process?
source share