Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The preferred way to add multiple items to the ListBox is to use the AddRange method of the ListBox.ObjectCollection class (through the Items property of the ListBox). This enables you to add an array of items to the list in a single operation. However, if you want to add items one at a time using the Add method of the ListBox.ObjectCollection class, you can use the method to prevent the control from repainting the ListBox each time an item is added to the list. Once you have completed the task of adding items to the list, call the EndUpdate method to enable the ListBox to repaint. This way of adding items can prevent flickered drawing of the ListBox when a large number of items are being added to the list.
The following code example uses the and EndUpdate methods while adding five thousand items to a ListBox. This example requires that a ListBox control, named listBox1, has been added to a Form and that this method is placed within the form and called from it.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)