GridColumnStylesCollection.AddRange Method
.NET Framework 4.5
Adds an array of column style objects to the collection.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
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); }
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.