ColumnDefinitionCollection.RemoveRange Method (Int32, Int32)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Removes a range of ColumnDefinition objects from a ColumnDefinitionCollection.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

Public Sub RemoveRange (
	index As Integer,
	count As Integer
)

Parameters

index
Type: System.Int32

The position within the collection at which the first ColumnDefinition is removed.

count
Type: System.Int32

The total number of ColumnDefinition objects to remove from the collection.

ColumnDefinitionCollection uses a zero-based indexing system.

The following example demonstrates how to use the RemoveRange method to remove a range of ColumnDefinition elements from a ColumnDefinitionCollection.

Private Sub rem5Col(ByVal sender As Object, ByVal e As RoutedEventArgs)
    If (grid1.ColumnDefinitions.Count < 5) Then
        tp1.Text = "There aren't five Columns to Remove!"
    Else
        grid1.ColumnDefinitions.RemoveRange(0, 5)
    End If
End Sub

To view the complete sample, see How to: Manipulate Columns and Rows by Using ColumnDefinitionsCollections and RowDefinitionsCollections.

.NET Framework
Available since 3.0
Return to top
Show: