I'm working in VS2008 on a C# WinForms app. By default when clicking on a column header in a DataGridView it sorts that column Ascending, you can then click on the column header again to sort it Descending.
I am trying to reverse this, so the initial click sorts Descending then the second click sorts Ascending and I haven't been able to figure out how to do this. Does anyone know?
Thanks
I suggest below code
Take a look at
DataGridView.SortCompare
. See slightly modified version of the msdn example below:and
You can set the HeaderCell SortGlyphDirection to Ascending, and then the next click will give you the descending order. The default is none.