NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataTable.FindRow (DataColumn, Object)

Finds and returns a DataRow with the specified value in the specified column.

[Visual Basic]
Overloads Protected Function FindRow( _
   ByVal column As DataColumn, _
   ByVal value As Object _
) As DataRow
[C#]
protected DataRow FindRow(
   DataColumn column,
   object value
);
[C++]
protected: DataRow* FindRow(
   DataColumn* column,
   Object* value
);
[JScript]
protected function FindRow(
   column : DataColumn,
   value : Object
) : DataRow;

Parameters

column
A DataColumn that specifies the column to search in.
value
An value that is to be found in the named column.

Return Value

A DataRow whose column values match those specified in the method.

Remarks

You can also use Select method to find a specific row in the DataTable. Furthermore, the Find and Contains methods of the RowsCollection also return specific rows or values in rows.

Example [Visual Basic]

The following example uses the FindRows method to return a DataRow containing the specified value.

[Visual Basic]

Private Sub FindThisRow()
   Dim findInThisCol As DataColumn
   Dim findThisVal 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.
   findInThisCol = t.Columns("SupplierID")
   ' Set the value to find.
   findThisVal = 25
   
   foundRow = t.FindRows(findInThisCol, findThisVal)
   Console.WriteLine(foundRow(1))
End Sub

See Also

DataTable Class | DataTable Members | System.Data Namespace | DataTable.FindRow Overload List | DataRow | Contains | Find