DataView.Find 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
透過指定的排序鍵值在 中 DataView 尋找一列。
多載
| 名稱 | Description |
|---|---|
| Find(Object[]) |
透過指定的排序鍵值在 中 DataView 尋找一列。 |
| Find(Object) |
透過指定的排序鍵值在 中 DataView 尋找一列。 |
Find(Object[])
- 來源:
- DataView.cs
- 來源:
- DataView.cs
- 來源:
- DataView.cs
- 來源:
- DataView.cs
- 來源:
- 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[] -> int
Public 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)
- 來源:
- DataView.cs
- 來源:
- DataView.cs
- 來源:
- DataView.cs
- 來源:
- DataView.cs
- 來源:
- DataView.cs
透過指定的排序鍵值在 中 DataView 尋找一列。
public:
int Find(System::Object ^ key);
public int Find(object? key);
public int Find(object key);
member this.Find : obj -> int
Public 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