System.Windows.Forms.BindingSource.Find Method

Returns the index of the item in the list with the specified property name and value.

Syntax

public int Find (string propertyName, object key)

Parameters

propertyName
The name of the property to search for.
key
The value of the item with the specified propertyName to find.

Returns

The zero-based index of the item with the specified property name and value.

Remarks

The BindingSource.Find(string, object) method can only be used when the underlying list is an System.ComponentModel.IBindingList with searching implemented. This method simply refers the request to the underlying list's System.ComponentModel.IBindingList.Find(System.ComponentModel.PropertyDescriptor, object) method. For example, if the underlying data source is a System.Data.DataSet, System.Data.DataTable, or System.Data.DataView, this method converts propertyName to a System.ComponentModel.PropertyDescriptor and calls the System.Data.DataView.System#ComponentModel#IBindingList#Find(System.ComponentModel.PropertyDescriptor, object) method. The behavior of BindingSource.Find(System.ComponentModel.PropertyDescriptor, object), such as the value returned if no matching item is found, depends on the implementation of the method in the underlying list.

The property name comparison is case-insensitive.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0