473,569 Members | 2,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BindingList: How to implement Find?

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
Feb 24 '06 #1
1 8917
guy
Hi,
you need the following:-
Protected Overrides ReadOnly Property SupportsSearchi ngCore() As Boolean
Get
Return True
End Get
End Property

then implement FindCore with your search
hint:
compare the PropertyDescrip tor.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 PropertyDescrip torCollection =
TypeDescriptor. GetProperties(M e.Items(0).GetT ype)
Dim myProperty As PropertyDescrip tor = properties.Find (ColumnName,
False)
Dim i As Integer = FindCore(myProp erty, 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

Feb 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1262
by: TG | last post by:
Is it possible to implement Find functionality in a Web Forms datagrid? If so, is there sample code I can look at? thanks tg
1
7868
by: Kevin | last post by:
Hello, Does anyone know how to implement find and replace in a RichTextBox in a way that does not lose the text formatting? As a first attempt I tried rtb.Rtf.Replace(sFindText, sReplaceText) , but that's no good since .Rtf includes all the formatting codes, and .Replace will change richtext codes that shouldn't be changed.
4
3502
by: hazz | last post by:
The data access layer below returns, well, a mess as you can see on the last line of this posting. What is the best way to return customer objects via a datareader from the data layer into my view and bind them to a datagrid using BindingList. I am in need of an epiphany here. Thank you. -Greg ******************BIND ARRAY OF CUSTOMER...
1
3906
by: Pieter | last post by:
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 =...
1
1851
by: Pieter | last post by:
Hi, I use a customized Generic List (VB.NET 2.0) inherited from BindingList(Of T). I made some methods in this BindingList, to allow me to do some standard functions on the BindingList-Items. One of them is for instance SumItems, which returns me the sum of a given Property of all the Items in the List.
6
16824
by: jwilson128 | last post by:
I am trying to decide whether to use a system.ComponentModel.BindingList(of T) or a Sytem.Collections.Generic.List(of T) for a custom collection. In testing a simple, read-only data binding to a data grid view - they both work. Are there aspects of databinding that the regular list will not support and vice-versa, is there any reason to...
10
1630
by: Rick | last post by:
VS 2005 I have a class of BindingList(of T) to use as a datasource for a lookup combobox. The combobox is to lookup the Terms for a Purchase Order. When I implement this on my Winform, the combobox does not synch with the underlying data, i.e. the Terms description does not show for the terms number. The combobox does show the...
3
9674
by: jehugaleahsa | last post by:
Hello: I am binding a DataGridView with a BindingList<T>, where T is a custom business object that implements INotifyPropertyChanged. When you bind a DataGridView to a DataTable, it has this cool little feature - it will not call DataTable.Rows.Add until after you leave the DataGridView row. This is cool because it lets your user edit the...
1
1409
by: soubins | last post by:
I want to work the finding option in my windows application as in Notepad.Can any one pls give c# code corresponding to it??? I need to generate a windows application as Notepad.pls help me...
0
7701
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8130
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.