This documentation is archived and is not being maintained.

DataGridColumnStyle.BeginUpdate Method

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

[Visual Basic]
Protected Sub BeginUpdate()
protected void BeginUpdate();
protected: void BeginUpdate();
protected function BeginUpdate();


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.


[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

   ' Code to update not shown here.

   For Each dgc In dgCols

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.


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