Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
VB.NET
VB.NET General Discussion
Sorting of a List. Worked at first, not working now.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="jmcilhinney, post: 167586, member: 641"] You can use any object that implements the IList or IListSource interface as the data source for a DataGridView. That's a lot of different types of objects. In order for the data in the data source to be able to be sorted, the object must also implement the IBindingList interface. It's that interface that provides knowledge of data-binding to the list. The List(Of T) class implements IList but not IBindingList, therefore it doesn't support sorting via a bound control. The BindingList(Of T) class does implement the IBindingList interface, although it doesn't provide a default implementation for sorting. You can inherit BindingList(Of T) and provide your own implementation for sorting your own item type and then use an instance of that derived class as the data source for your grid. Alternatively, you can put your data into a DataTable. The DataTable class implements the IListSource interface and its GetList method returns a DataView, which implements IList, IBindingList and, for advanced sorting and filtering, IBindingListView. The DataView class does provide a default implementation for sorting so you don't have to. The DataTable/DataView is not strongly-typed to your data though, so you do lose something in order to get that general-purpose sorting. [/QUOTE]
Insert quotes…
Verification
Post reply
VB.NET
VB.NET General Discussion
Sorting of a List. Worked at first, not working now.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom