Export (0) Print
Expand All

DataGridColumnStyle.BeginUpdate Method

Suspends the painting of the column until the EndUpdate method is called.

[Visual Basic]
Protected Sub BeginUpdate()
[C#]
protected void BeginUpdate();
[C++]
protected: void BeginUpdate();
[JScript]
protected function BeginUpdate();

Remarks

When many changes are made to the appearance of a System.Windows.Forms.DataGrid control (whether the changes are in the attributes of the column or the data displayed by the control), you should invoke the BeginUpdate method to temporarily freeze the drawing of the control. This results in less distraction to the user, and a performance gain. After all updates have been made, invoke the EndUpdate method to resume drawing of the control.

Example

[Visual Basic] The following example begins and ends an update on a DataGridColumnStyle.

[Visual Basic] 
Private Sub BeginEndUpdate()
   ' MyDataGridColumnStyle is a class derived from DataGridColumnStyle.
   Dim dgc As MyDataGridColumnStyle
   Dim dgCols As GridColumnStylesCollection
   dgCols = DataGrid1.TableStyles(0).GridColumnStyles
   For Each dgc In dgCols
      dgc.BeginUpdate
   Next 

   ' Code to update not shown here.

   For Each dgc In dgCols
      dgc.EndUpdate
   Next

End Sub

[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

DataGridColumnStyle Class | DataGridColumnStyle Members | System.Windows.Forms Namespace | EndUpdate

Show:
© 2014 Microsoft