SortedBindingList: SupportsSearching

SortedBindingList: SupportsSearching

Old forum URL: forums.lhotka.net/forums/t/347.aspx


Helen W posted on Monday, June 12, 2006

I am trying to use the SortedBindingList with a class that inherits from BusinessListBase, to provide two sorted views of the list.

I define

public class CompanyList : BusinessListBase<CompanyList, Company>

{

private static CompanyList m_list;

private static SortedBindingList<Company> m_sortByPhoneNo;

...

When m_list is filled, I sort the list so:

m_sortByPhoneNo = new SortedBindingList<Company>(m_list);

m_sortByPhoneNo.ApplySort("PhoneNumber", System.ComponentModel.ListSortDirection.Ascending);

...

However, when I call the .Find method on m_sortByPhoneNo, my app errors out because .SupportsSearching is false.

How do I need to structure these classes to ensure that sorting is supported?

Thx

Helen

RockfordLhotka replied on Monday, June 12, 2006

Neither BusinessListBase nor SortedBindingList support filtering or searching (and neither does the base BindingList class from Microsoft). At the present time, you'll need to implement your own class, possibly somewhat like SortedBindingList, that does filtering or searching by implementing that portion of the IBindingList interface.

Copyright (c) Marimer LLC