GridColumnStylesCollection.Remove-Methode
Entfernt den angegebenen DataGridColumnStyle aus der GridColumnStylesCollection.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Syntax
'Declaration
Public Sub Remove ( _
column As DataGridColumnStyle _
)
'Usage
Dim instance As GridColumnStylesCollection
Dim column As DataGridColumnStyle
instance.Remove(column)
public void Remove (
DataGridColumnStyle column
)
public:
void Remove (
DataGridColumnStyle^ column
)
public void Remove (
DataGridColumnStyle column
)
public function Remove (
column : DataGridColumnStyle
)
Parameter
- column
Der aus der Auflistung zu entfernende DataGridColumnStyle.
Hinweise
Ermitteln Sie mithilfe der Contains-Methode, ob der DataGridColumnStyle in der Auflistung vorhanden ist.
Beispiel
Im folgenden Codebeispiel wird ein DataGridColumnStyle aus einer GridColumnStylesCollection entfernt.
Private Sub RemoveColumnStyle_Clicked(sender As Object, e As EventArgs) Handles removeStyle.Click
Dim myTableStyle As DataGridTableStyle = myDataGrid.TableStyles(0)
' Get the GridColumnStylesCollection of Data Grid.
myColumns = myTableStyle.GridColumnStyles
Dim i As Integer
' Remove the CustName ColumnStyle from the data grid.
If myColumns.Contains("CustName") Then
Dim myDataColumnStyle As DataGridColumnStyle = myColumns("CustName")
i = myColumns.IndexOf(myDataColumnStyle)
myColumns.RemoveAt(i)
End If
End Sub 'RemoveColumnStyle_Clicked
private void RemoveColumnStyle_Clicked(object sender, EventArgs e)
{
DataGridTableStyle myTableStyle = myDataGrid.TableStyles[0];
// Get the GridColumnStylesCollection of Data Grid.
myColumns = myTableStyle.GridColumnStyles;
int i;
// Remove the CustName ColumnStyle from the data grid.
if(myColumns.Contains("CustName"))
{
DataGridColumnStyle myDataColumnStyle= myColumns["CustName"];
i= myColumns.IndexOf(myDataColumnStyle);
myColumns.RemoveAt(i);
}
}
private:
void RemoveColumnStyle_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ )
{
DataGridTableStyle^ myTableStyle = myDataGrid->TableStyles[ 0 ];
// Get the GridColumnStylesCollection of Data Grid.
myColumns = myTableStyle->GridColumnStyles;
int i;
// Remove the CustName ColumnStyle from the data grid.
if ( myColumns->Contains( "CustName" ) )
{
DataGridColumnStyle^ myDataColumnStyle = myColumns[ "CustName" ];
i = myColumns->IndexOf( myDataColumnStyle );
myColumns->RemoveAt( i );
}
}
private void RemoveColumnStyleClicked(Object sender, EventArgs e)
{
DataGridTableStyle myTableStyle = myDataGrid.get_TableStyles().
get_Item(0);
// Get the GridColumnStylesCollection of Data Grid.
myColumns = myTableStyle.get_GridColumnStyles();
int i;
// Remove the CustName ColumnStyle from the data grid.
if (myColumns.Contains("CustName")) {
DataGridColumnStyle myDataColumnStyle = myColumns.
get_Item("CustName");
i = myColumns.IndexOf(myDataColumnStyle);
myColumns.RemoveAt(i);
}
} //RemoveColumnStyleClicked
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
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
GridColumnStylesCollection-Klasse
GridColumnStylesCollection-Member
System.Windows.Forms-Namespace
Add
DataGridColumnStyle-Klasse
DataGridTableStyle.GridColumnStyles-Eigenschaft
RemoveAt