Gets a value indicating whether any row in the collection contains a specified value in the primary key or keys column.
Gets a value indicating if the DataRow with the specified primary key values exists.
[Visual Basic] Overloads Public Function Contains(Object()) As Boolean
[C#] public bool Contains(Object[]);
[C++] public: bool Contains(Object*[]);
[JScript] public function Contains(Object[]) : Boolean;
Gets a value indicating whether the primary key of any row in the collection contains the specified value.
[Visual Basic] Overloads Public Function Contains(Object) As Boolean
[C#] public bool Contains(Object);
[C++] public: bool Contains(Object*);
[JScript] public function Contains(Object) : Boolean;
The following example uses the Contains method to determine if a RowsCollection object contains a specific value.
Note This example shows how to use one of the overloaded versions of Contains. For other examples that may be available, see the individual overload topics.
[Visual Basic]
Private Sub ColContains() Dim t As DataTable Dim rc As RowsCollection Set t = DataGrid1.DataGridTable.DataTable Set rc = t.Rows If rc.Contains(Edit1.Text) Then Label1.Text = "At least one row contains " & Edit1.Text Else Label1.Text = "No row contains the value in its primary key field" End If End Sub
RowsCollection Class | RowsCollection Members | System.Data Namespace