I have a datagridview. It have several columns in it. It is based on a dataview.
initially I set the dataview to sort by multiple columns. Which works fine. Then on the gui if the user clicks on a column it sorts by that column, which is also fine... for now.
But on of my columns is kinda odd. The data in it is string... ## h or ## d representing a number of hours or number of days. So the default sort on that won't work... S o I want to tell my datagridview how to sort that column...
So far my searching has turned up the the event sortcompare. I put in a stub for it. And I tried setting it two different ways. One using VS properties/events window to set the event handler. and the other was to add this code to form1 constructor.
dataGridView1.SortCompare += new
DataGridViewSortCompareEventHandler(this
.dataGridView1_SortCompare);
Neither way got my code called, (set a breakpoint in the stub).
I even tried taking out the line that set the sort on the dataView just in case... still no luck.
So my questions...
1 is sortCompare the right way to go, seems a bit large in scope since it should be called for any sort on any column, but I assume I can just check the column name, and call the default handler if it isn't my "special" column.
1.5 assuming the answer to 1 is yes, how do I call the default sorter for the other columns
2 how can I get my sortCompare replacement proc called.