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
Available since 1.1
Return to top
Show: