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

GridTableStylesCollection.AddRange Method

Adds an array of table styles to the collection.

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

public virtual void AddRange(
	DataGridTableStyle[] tables
)

Parameters

tables
Type: System.Windows.Forms.DataGridTableStyle[]

An array of DataGridTableStyle objects.

The following code example demonstrates the use of this member.

private void AddArray()
{


/* Get three CurrencyManager objects used to construct 
DataGridTableSTyle objects. */
CurrencyManager customersManager = (CurrencyManager)
this.BindingContext[myDataSet, "Customers"];

CurrencyManager regionsManager = (CurrencyManager)
this.BindingContext[myDataSet, "Customers"];

CurrencyManager productsManager = (CurrencyManager)
this.BindingContext[myDataSet, "Customers"];


DataGridTableStyle gridCustomers = 
new DataGridTableStyle(customersManager);
DataGridTableStyle gridRegions = 
new DataGridTableStyle(regionsManager);
DataGridTableStyle gridProducts = 
new DataGridTableStyle(productsManager);

// Create a DataGridTableStyle array.
DataGridTableStyle[] myGrids = {gridCustomers, gridRegions, gridProducts};

// Use AddRange to add to the collection.
myDataGrid.TableStyles.AddRange(myGrids);

}

.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