How to select all items in a ListBox really fast?
Assuming this is a Windows Forms
problem: Windows Forms will draw changes after each selected item. To disable drawing and enable it after you're done use the BeginUpdate()
and EndUpdate()
methods.
listBox.BeginUpdate();
for (int i = 0; i < listBox.Items.Count; i++)
listBox.SetSelected(i, true);
listBox.EndUpdate();