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

Removes a specific row from the RowsCollection.

Overload List

Removes the row with the specified index from the collection.

[Visual Basic] Overloads Public Sub Remove(Integer)
[C#] public void Remove(int);
[C++] public: void Remove(int);
[JScript] public function Remove(int);

Removes the specified DataRow from the collection.

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

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.

Note   This example shows how to use one of the overloaded versions of Remove. For other examples that may be available, see the individual overload topics.

[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