GridColumnStylesCollection.AddRange Method (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(
	DataGridColumnStyle[] columns


Type: 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.

private void AddStyleRange()
   // Create two DataGridColumnStyle objects.
   DataGridColumnStyle col1 = new DataGridTextBoxColumn();
   col1.MappingName = "FirstName";
   DataGridColumnStyle col2 = new DataGridBoolColumn();
   col2.MappingName = "Current";

   // Create an array and use AddRange to add to collection.
   DataGridColumnStyle[] cols = new DataGridColumnStyle[2] {col1, col2};

.NET Framework
Available since 1.1
Return to top