Hi,
you need the following:-
Protected Overrides ReadOnly Property SupportsSearchingCore() As Boolean
Get
Return True
End Get
End Property
then implement FindCore with your search
hint:
compare the PropertyDescriptor.GetValue with the property you are sorting
against
finally implement a GetItem (or similar) method something like:-
Public Function GetItem(ByVal ColumnName As String, ByVal ColumnValue As
Object) As T
Dim properties As PropertyDescriptorCollection =
TypeDescriptor.GetProperties(Me.Items(0).GetType)
Dim myProperty As PropertyDescriptor = properties.Find(ColumnName,
False)
Dim i As Integer = FindCore(myProperty, ColumnValue)
If i = -1 Then
Return Nothing
Else
Return Me.Item(i)
End If
End Function
"Pieter" wrote:
Hi,
I have my own custom BindingList, that inherits from BindingList, and
implements IComponent.
I would like to implement a Find-method, that will allow me to search for a
property of my Items.
So basicly: If my Items in the List have a property Name, I would like to be
able to return with this method all the items that have Name = 'Bill Gates'
etc.
Any idea how I should implement this? Any hints, links, samples would be
really appreciated.
Thanks a lot in advance,
Pieter