System.Data Namespace DataRowCollection Class
Checks whether any row in the collection contains a specified value in the primary key or keys column.
1. Checks whether the primary key of any row in the collection contains the specified value.
2. Checks whether the primary key Column ( s ) of any row in the collection contains the values specified in the object array.
The following example uses the Contains method to determine if a DataRowCollection object contains a specific value.
NOTE: This example uses one of the overloaded versions of Contains. For other examples that may be available, see the individual overload topics.
Private Sub ColContains ( )
Dim myTable As DataTable
Dim myRows As DataRowCollection
myTable = myGrid.DataGridTable.DataTable
myRows = myTable.Rows
If myRows.Contains ( Edit1.Text ) Then
Label1.Text = "At least one row contains " & Edit1.Text
Else
Label1.Text = "No row contains the specified value"
End If
End Sub
DataRowCollection Members