GridColumnStylesCollection::AddRange Method (array<DataGridColumnStyle^>^)

 

Adds an array of column style objects to the collection.

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

public:
void AddRange(
	array<DataGridColumnStyle^>^ columns
)

Parameters

columns
Type: array<System.Windows.Forms::DataGridColumnStyle^>^

An array of DataGridColumnStyle objects to add to the collection.

The following code example creates an array of DataGridColumnStyle objects, and uses the AddRange method to add the array to the GridColumnStylesCollection.

void AddStyleRange()
{

   // Create two DataGridColumnStyle objects.
   DataGridColumnStyle^ col1 = gcnew DataGridTextBoxColumn;
   col1->MappingName = "FirstName";
   DataGridColumnStyle^ col2 = gcnew DataGridBoolColumn;
   col2->MappingName = "Current";

   // Create an array and use AddRange to add to collection.
   array<DataGridColumnStyle^>^cols = {col1,col2};
   dataGrid1->TableStyles[ 0 ]->GridColumnStyles->AddRange( cols );
}

.NET Framework
Available since 1.1
Return to top
Show: