Results 1 to 5 of 5

Thread: filtering lists

  1. #1

    Thread Starter
    Hyperactive Member fabianus's Avatar
    Join Date
    Sep 2004
    Location
    Paris
    Posts
    402

    Question filtering lists

    Hello !

    I constructed my own filtering system, that gives me the possibility to create complex filters on object lists (like list(of mytype)).
    Some time went by and I just wanted to be sure that the framwork does not incorporate such a functionality now.
    The idea is that I may filter on various properties of my objects stored in the object list (or even on properties of the objet's properties... etc.), creating and/or associations of the arguments.

    Thanks for any feedback :-)

    Regards,
    Fabian

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: filtering lists

    The BindingSource provides this functionality by allowing you to bind a list to it and then set its Filter property. It's usually used with DataTables but it can be bound to any object that can serve as a DataSource for a control. The BindingSource can then be bound to a control, allowing you to indirectly bind any array or collection you like to a control and then sort and/or filter what gets displayed.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member fabianus's Avatar
    Join Date
    Sep 2004
    Location
    Paris
    Posts
    402

    Re: filtering lists

    I see! If I understand it right, then the BindingSource might be used in any circumstances, not only for controls. Meaning that I might retrieve the filtered list of objects to do anything else with them. If this is so... than I lost quite some time for nothing building my filter system ....

    Thanks very much for this hot info!

    Regards,
    Fabian

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: filtering lists

    Ah, I just investigated further and only lists that implement the IBindingListView interface can be filtered through a BindingSource. The DataView class does, which is why DataTables can be filtered. It appears that you may not have wasted your time after all.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Hyperactive Member fabianus's Avatar
    Join Date
    Sep 2004
    Location
    Paris
    Posts
    402

    Re: filtering lists

    Hey jmcilhinney,

    in this concern : did you discover Linq of the framework 3 ?!

    Best regards,
    Fabian

    PS Happy new year.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width