System.Windows.Forms.ListBox.BeginUpdate Method

Maintains performance while items are added to the System.Windows.Forms.ListBox one at a time by preventing the control from drawing until the ListBox.EndUpdate method is called.

Syntax

public void BeginUpdate ()

Remarks

The preferred way to add multiple items to the System.Windows.Forms.ListBox is to use the System.Windows.Forms.ListBox.ObjectCollection.AddRange(System.Windows.Forms.ListBox.ObjectCollection) method of the System.Windows.Forms.ListBox.ObjectCollection class (through the ListBox.Items property of the System.Windows.Forms.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 System.Windows.Forms.ListBox.ObjectCollection.Add(object) method of the System.Windows.Forms.ListBox.ObjectCollection class, you can use the ListBox.BeginUpdate method to prevent the control from repainting the System.Windows.Forms.ListBox each time an item is added to the list. Once you have completed the task of adding items to the list, call the ListBox.EndUpdate method to enable the System.Windows.Forms.ListBox to repaint. This way of adding items can prevent flickered drawing of the System.Windows.Forms.ListBox when a large number of items are being added to the list.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0