Export (0) Print
Expand All

TreeView.EndUpdate Method

Enables the redrawing of the tree view.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member EndUpdate : unit -> unit

To maintain performance while items are added one at a time to the TreeView, call the BeginUpdate method. The BeginUpdate method prevents the control from painting until the EndUpdate method is called.

The preferred way to add items to a tree view control is to use the AddRange method to add an array of tree node items to a tree view. However, if you want to add items one at a time, use the BeginUpdate method to prevent the TreeView control from painting during the add operations. To allow control the control to resume painting, call the EndUpdate method when all the tree nodes have been added to the tree view.

The following code example displays customer information in a TreeView control. The root tree nodes display customer names, and the child tree nodes display the order numbers assigned to each customer. In this example, 1,000 customers are displayed with 15 orders each. The repainting of the TreeView is suppressed by using the BeginUpdate and EndUpdate methods, and a wait Cursor is displayed while the TreeView creates and paints the TreeNode objects. This example requires that you have a Customer object that can hold a collection of Order objects. It also requires that you have a cursor file that is named MyWait.cur in the application directory and that you have created an instance of a TreeView control on a Form.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft