Way back when Nani wrote the Table of Contents for OneNote 2007, I looked at her code. She used a DataGridView control to help create the table of contents. This is a nice control to have available and she had this line in the original code:
Notice that Sort method? It is included with the DataGridView:
Sort(DataGridViewColumn, ListSortDirection) and here is the MSDN definition:
Sorts the contents of the DataGridView control in ascending or descending order based on the contents of the specified column.
(See, I use OneNote to write these blog entries. I'm leaving in the URL location text here just to help make that point).
That control has a TON of properties, methods and events built into it. The documentation for it is complete and there are many samples and code snippets that go with it. The sort method is buried in there and I'm happy someone managed to find and use it.
Anyway, we talked about this a little and realized that once the data from any table was put into this control, it could be sorted. From there, it got put on the back burner while we worked on OneNote 2010. Now that we are done, Nani took another look at the control and finished this powertoy. I know this has been requested and it's nice to see a solution available.
As mentioned last week, I'm including the code here. Thanks Nani! It is included in the link below my signature below. If you extend this, localize it for another language or anything else, please let me know. I'd love to go ahead and post any updates anyone makes, or just link to what you do to make this even better.
Questions, comments, concerns and criticisms always welcome,