Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

GridColumnStylesCollection.Clear Method

Clears the collection of DataGridColumnStyle objects.

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

public void Clear()

The following code example demonstrates the use of this member.

private void Clear_Clicked(object sender, System.EventArgs e)
{
   // TablesAlreadyAdded set to false so that table styles can be added again.
   TablesAlreadyAdded = false;
   myLabel.Text = "All Table Styles Cleared.";
   // Clear all the column styles and also table style for the grid. 
   foreach (DataGridTableStyle myTableStyle in myDataGrid.TableStyles)
   {
      GridColumnStylesCollection myColumns = myTableStyle.GridColumnStyles;
      myColumns.Clear();
   }
   myDataGrid.TableStyles.Clear();
}

.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