I really like the new DataGridView control, however, it always seems to sort columns containing numbers and dates as if they were strings. The Windows Forms 1.x ListView control did the same thing so what I ended up doing was to create an class that implements the IComparer interface. How do we handle this in DataGridView

DataGridView Soring
Pierrelud
Ok, I'll take a look into the Icomparer then.
Thanks!
str01014
When databound the DataGridView does not perform any code for sorting but asks the datasource to sort. When unbound the DataGridView performs the sort and it doesn't have any logic to perform custom "smart" sorting of strings.
-mark
DataGridView Program Manager
Microsoft
This post is provided "as-is"
ProgrammerJ
Hope this helps!
-mark
.NET Client Program Manager
Microsoft
This post is provided "as-is"
DonHutson
Sunny G.
So, I guess I am at a loss with what to do here. My application has dynamic bound datasources depending on choices in the form, as well as where it was launched from. (i.e. different stored procedures as the source) So creating separate datasource procedures for every sort possibility is not an option for me. I don't understand why this functionality was removed from both the datagridview and datagrid controls.....
Should I be using a different control here I really like all the other features of the datagridview... but without the smart sorting, it won't be of much use to me. Is there another type available, or plans to add the smart sorting into the control
Thanks!
Rob
rolfpf
The only option for the DataGridview in to use it in an unbound mode and create a custom IComparer class that performs smart sort. There are no plans to change how the DataGridView sorts when databound.
-mark
DataGridView Program Manager
Microsoft
This post is provided "as-is"
jphamel
Pete Sheill
If that's the case, then I am totally lost. (Which is easy as I am a noob)
I have a bound datagridview that insists on sorting everything as if it were a string. In VS.net my datagrids worked just fine using the 'd' format. After upgrading to VS 2005, neither the datagrid, or the new datagridview control sorts numbers and dates correctly, regardless of the format I specify.
Please help!