Freigeben über


GridColumnStylesCollection.AddRange-Methode

Fügt der Auflistung ein Array von Spaltenformatobjekten hinzu.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Sub AddRange ( _
    columns As DataGridColumnStyle() _
)
'Usage
Dim instance As GridColumnStylesCollection
Dim columns As DataGridColumnStyle()

instance.AddRange(columns)
public void AddRange (
    DataGridColumnStyle[] columns
)
public:
void AddRange (
    array<DataGridColumnStyle^>^ columns
)
public void AddRange (
    DataGridColumnStyle[] columns
)
public function AddRange (
    columns : DataGridColumnStyle[]
)

Parameter

  • columns
    Ein Array von DataGridColumnStyle-Objekten, die der Auflistung hinzugefügt werden sollen.

Beispiel

Im folgenden Codebeispiel wird ein Array von DataGridColumnStyle-Objekten erstellt und mithilfe der AddRange-Methode der GridColumnStylesCollection hinzugefügt.

Private Sub AddStyleRange()
    ' Create two DataGridColumnStyle objects.
    Dim col1 As New DataGridTextBoxColumn()
    col1.MappingName = "FirstName"
    Dim col2 As New DataGridBoolColumn()
    col2.MappingName = "Current"
       
    ' Create an array and use AddRange to add to collection.
    Dim cols() As DataGridColumnStyle = {col1, col2}
    dataGrid1.TableStyles(0).GridColumnStyles.AddRange(cols)
End Sub
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);
}
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 );
}
private void AddStyleRange()
{
    // Create two DataGridColumnStyle objects.
    DataGridColumnStyle col1 = new DataGridTextBoxColumn();
    col1.set_MappingName("FirstName");
    DataGridColumnStyle col2 = new DataGridBoolColumn();
    col2.set_MappingName("Current");

    // Create an array and use AddRange to add to collection.
    DataGridColumnStyle cols[] = new DataGridColumnStyle[] { col1, col2 };
    dataGrid1.get_TableStyles().get_Item(0).get_GridColumnStyles().
        AddRange(cols);
} //AddStyleRange
function AddStyleRange(dataGrid: DataGrid)
{
   // Create two DataGridColumnStyle objects.
   var col1: DataGridColumnStyle = new DataGridTextBoxColumn();
   col1.MappingName = "FirstName";
   var col2: DataGridColumnStyle = new DataGridBoolColumn();
   col2.MappingName = "Current";

   // Create an array and use AddRange to add to collection.
   var cols: DataGridColumnStyle[] = [col1, col2];
   dataGrid.TableStyles[0].GridColumnStyles.AddRange(cols);
}

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

GridColumnStylesCollection-Klasse
GridColumnStylesCollection-Member
System.Windows.Forms-Namespace