Gets a specified DataRow.
Gets the row containing the specified primary key values.
[Visual Basic] Overloads Public Function Find(Object()) As DataRow
[C#] public DataRow Find(Object[]);
[C++] public: DataRow* Find(Object*[]);
[JScript] public function Find(Object[]) : DataRow;
Gets the row specified by the primary key value.
[Visual Basic] Overloads Public Function Find(Object) As DataRow
[C#] public DataRow Find(Object);
[C++] public: DataRow* Find(Object*);
[JScript] public function Find(Object) : DataRow;
The following example uses the Find method to find the primary key value "2" in a collection of DataRow objects. The method returns the specific DataRow object allowing you to change its values, as needed.
Note This example shows how to use one of the overloaded versions of Find. For other examples that may be available, see the individual overload topics.
[Visual Basic]
Private Sub FindInPKey() Dim t As DataTable Dim foundRow As DataRow Dim rc As RowsCollection Set t = DataGrid1.DataGridTable.DataTable Set rc = t.Rows ' Find the number 2 in the primary key column of the table. Set foundRow = rc.Find(2) ' Display the value of column 1 in a Label control. Label1.Text = foundRow.Item(1) End Sub
RowsCollection Class | RowsCollection Members | System.Data Namespace