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 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;

Parameters

columns
An array of DataColumn objects that specify the columns to search in.
values
[To be supplied.]

Return Value

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

Remarks

You can also use the Find and Contains methods of the RowsCollection to find specific rows or values in rows.

Example [Visual Basic]

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

See Also

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