I have a DataGridView (WinForms) populated with a relatively large table, using a DataTable as the DataSource. When the user clicks a column header, sorting starts and this is desired. However, the sorting takes a while and I would like to allow the user to abort the operation: A button is displayed that the user would click to abort the operation. It this possible? If so, how?
A:
Not aborting but see this post for improving DataGrid's sorting performance: http://blogs.msdn.com/b/jgoldb/archive/2008/08/26/improving-microsoft-datagrid-ctp-sorting-performance.aspx
Or you can extract out the sorting mechanism, and run it in a background thread which can be cancelled. That way the UI won't hang up, and the user won't feel to cancel it. To add some spice, you can add a progress bar that notifies the user about sorting progress.
chown
2010-09-22 01:18:00
My question is about the WinForms DataGridView, not the WPF DataGrid. I find that sorting of 200k rows takes seconds, not minutes. This may be different for the WPF DataGrid.
ILoveFortran
2010-09-23 00:11:01