Finds and returns a DataRow with the specified values in the specified columns.
[Visual Basic] Overloads Protected Function FindRow( _ ByVal columns() As DataColumn, _ ByVal values() As Object _ ) As DataRow [C#] protected DataRow FindRow( DataColumn[] columns, object[] values ); [C++] protected: DataRow* FindRow( DataColumn* columns[], Object* values[] ); [JScript] protected function FindRow( columns : DataColumn[], values : Object[] ) : DataRow;
A DataRow whose column values match those specified in the method.
You can also use the Find and Contains methods of the RowsCollection to find specific rows or values in rows.
The following example finds a single DataRow through the FindRow method.
[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
DataTable Class | DataTable Members | System.Data Namespace | DataTable.FindRow Overload List | DataRow | Contains | Find