Finds and returns a specific DataRow.
Finds and returns a DataRow with the specified value in the specified column.
[Visual Basic] Overloads Protected Function FindRow(DataColumn, Object) As DataRow
[C#] protected DataRow FindRow(DataColumn, Object);
[C++] protected: DataRow* FindRow(DataColumn*, Object);
[JScript] protected function FindRow(DataColumn, Object) : DataRow;
Finds and returns a DataRow with the specified values in the specified columns.
[Visual Basic] Overloads Protected Function FindRow(DataColumn(), Object()) As DataRow
[C#] protected DataRow FindRow(DataColumn[], Object[]);
[C++] protected: DataRow* FindRow(DataColumn*[], Object[]);
[JScript] protected function FindRow(DataColumn[], Object[]) : DataRow;
The following example finds a single DataRow through the FindRow method.
Note This example shows how to use one of the overloaded versions of FindRow. For other examples that may be available, see the individual overload topics.
[Visual Basic]
Private Sub FindThisRow() Dim arrCols(1) As DataColumn Dim arrVals(1) As Object Dim foundRow As DataRow Dim t As DataTable ' Use the DataTable of a DataGrid control. t = DataGrid1.DataGridTable.DataTable ' Get two columns from the table. arrCols(0) = t.Columns("SupplierID") arrCols(1) = t.Columns("CompanyName") ' Set the values to find, one for each column. arrVals(0) = 25 arrVals(1) = "Ma Maison" foundRow = t.FindRows(arrCols, arrVals) Console.WriteLine(foundRow(1)) End Sub