Removes the row with the specified index from the collection.
[Visual Basic] Overloads Public Sub Remove( _ ByVal index As Integer _ ) [C#] public void Remove( int index ); [C++] public: void Remove( int index ); [JScript] public function Remove( index : int );
Exception Type | Condition |
---|---|
IndexOutOfRangeException | No row corresponds to the given value. |
When a row is removed, data in that row is lost.
You can also use the Clear method to remove all members of the collection at once.
The following example removes the last row in a RowsCollection by calling the Remove method.
[Visual Basic]
Private Sub RemoveRowByIndex() Dim t As DataTable Dim rc As RowsCollection Dim foundRow As DataRow Set t = DataGrid1.DataGridTable.DataTable Set rc = t.Rows If rc.Count = 0 Then Exit Sub rc.Remove rc.Count - 1 End Sub
RowsCollection Class | RowsCollection Members | System.Data Namespace | RowsCollection.Remove Overload List | Clear | Add