This topic has not yet been rated - Rate this topic

GridColumnStylesCollection.AddRange Method

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
)

Parameters

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};
   dataGrid1.TableStyles[0].GridColumnStyles.AddRange(cols);
}

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.