DataView.Find 方法  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
根据指定的排序键值在 DataView 中查找行。
重载
| Find(Object[]) | 根据指定的排序键值在 DataView 中查找行。 | 
| Find(Object) | 根据指定的排序键值在 DataView 中查找行。 | 
Find(Object[])
- Source:
- DataView.cs
- Source:
- DataView.cs
- Source:
- DataView.cs
根据指定的排序键值在 DataView 中查找行。
public:
 int Find(cli::array <System::Object ^> ^ key);public int Find (object?[] key);public int Find (object[] key);member this.Find : obj[] -> intPublic Function Find (key As Object()) As Integer参数
返回
DataView 中与指定的排序键值匹配的第一个行的位置索引;如果没有匹配的排序键值,则为 -1。
示例
下面的 Visual Basic 示例使用 Find 方法返回在其排序键列中包含指定值的行的索引。
Private Sub FindValueInDataView(table As DataTable)
    Dim view As New DataView(table)
    view.Sort = "Customers"
    ' Find the customer named "John Smith".
    Dim vals(1) As Object
    vals(0)= "John"
    vals(1) = "Smith"
    Dim i As Integer = view.Find(vals)
    Console.WriteLine(view(i))
End Sub
另请参阅
适用于
Find(Object)
- Source:
- DataView.cs
- Source:
- DataView.cs
- Source:
- DataView.cs
根据指定的排序键值在 DataView 中查找行。
public:
 int Find(System::Object ^ key);public int Find (object? key);public int Find (object key);member this.Find : obj -> intPublic Function Find (key As Object) As Integer参数
- key
- Object
要搜索的对象。
返回
包含指定排序关键字值的 DataView 中的行的索引;否则为 -1(如果不存在排序关键字值)。
示例
下面的 Visual Basic 示例使用 Find 方法返回包含所需排序键列中值的行的索引。
Private Sub FindValueInDataView(table As DataTable)
    Dim view As New DataView(table)
    view.Sort = "CustomerID"
    ' Find the customer named "DUMON" in the primary key column
    Dim i As Integer = view.Find("DUMON")
    Console.WriteLine(view(i))
End Sub