I have a grid that is filled each time the form receives the focus. What happens is that this re-fill the grid I lose what i did before losing focus. How to save the grouping ?
Resetting the data source every time the form gets focus is not a good idea. You will lose all state information such as the activerow, the selected rows, any changes to positions or sizing of the rows and columns, etc.
My advice would be to avoid setting the DataSource on the grid or doing anything that might cause your data source to send a Reset notification if you possibly can.
But, if you want to try to save and restore the grid setting, you can use the Save and Load methods on the grid's DisplayLayout. These settings will only include band and column information, not any row-specific settings.
I'm saving the form below:Dim configGrade As SortedColumnsCollectionconfigGrade = Me.appGrid.DisplayLayout.Bands(0).SortedColumns
How can I do to recover after