NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

RowsCollection.Remove (DataRow)

Removes the specified DataRow from the collection.

[Visual Basic]
Overloads Public Sub Remove( _
   ByVal row As DataRow _
)
[C#]
public void Remove(
   DataRow row
);
[C++]
public: void Remove(
   DataRow* row
);
[JScript]
public function Remove(
   row : DataRow
);

Parameters

row
The DataRow to remove.

Remarks

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.

Example [Visual Basic]

The following example uses the Remove method to delete a found row in a RowsCollection object. The example first uses the Contains method to determine if the rows collection contains a row. If so, the Find method is used to find the specific row, and the Remove method is then used to remove the row.

[Visual Basic]

Private Sub RemoveFoundRow()
   Dim t As DataTable
   Dim rc As RowsCollection
   Dim foundRow As DataRow
   Set t = DataGrid1.DataGridTable.DataTable
   Set rc = t.Rows
   ' Test to see if the collection contains the value.
   If rc.Contains(Edit1.Text) Then
      Set foundRow = rc.Find(Edit1.Text)
      rc.Remove foundRow
      Label1.Text= "Row deleted."
   Else
      Label1.Text = "No such row found."
   End If
End Sub

See Also

RowsCollection Class | RowsCollection Members | System.Data Namespace | RowsCollection.Remove Overload List | Add | Clear | Contains | Find