How to sort a datagrid when clicking on column?

  • Thread starter Thread starter Jon Davis
  • Start date Start date
J

Jon Davis

How do I enable my Windows Forms datagrid to sort when I click on the column
header? I have a collection of custom classes that are displayed in my
datagrid, and it works great except for this missing feature! AllowSorting
property is set to True, but it doesn't seem to do anything.

Thanks,
Jon
 
Thanks!

Jon

Rob Windsor said:
Hi Jon,

Your collection class needs to implement IBindingList so the DataGrid will
know how to sort it. For the details check out this article:

Sorting the Unsortable Collection
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet01272004.asp

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada


Jon Davis said:
How do I enable my Windows Forms datagrid to sort when I click on the column
header? I have a collection of custom classes that are displayed in my
datagrid, and it works great except for this missing feature! AllowSorting
property is set to True, but it doesn't seem to do anything.

Thanks,
Jon
 
Back
Top