HiI'm using UltraWinGrid v9.2. I have a multiband dataset which is refreshing by the background thread.I've got a problem with activerow which changes after the data is loaded and any DB changes are merged. The dataset is all the time the same, both - its reference and its schema. There is only data which can change. The selection is forced to 1 row at a time (MaxSelectedRows = 1).
If I select any row from the 1st band the selection and activerow keeps unchanged. But when I select row from nested bands after refresh the grid activates 1st row in the 2nd band .RegardsMichal
If you are binding a WinGrid (or any control) to a DataSet which is being updated by another thread, the the selected rows are going to be the least of your worries. DataBinding is not thread-safe in DotNet.I strongly advise against doing this. There's a long, detailed discussion of this here:
Work with a dataset bound to a grid on a separate thread - Infragistics Community
Thanks Mike. You're right with your suggestions but our case is slightly different. I made a shortcut and it was not clear. There are 2 datasets. One used in worker thread to load data from DB. Another used in UI.The merge is done between those datasets on the UI thread so I think there is no way for the UltraGrid to use data while it is beeing updated. We also use mutex to prevent multiple access to the background dataset. The grid properly processes all kind of changes. The only thing which changes after the UI dataset merge is change in activerow. I found a workaround of that but maybe you'll know what is happening.
I had the same problem when binding a dataset to a multi band UltraGrid. Do you mind sharing how you worked around this problem?
Thanks a lot.
My custom data manager (which makes all the database refresh stuff in the background thread) generates custom events OnBeforeDataRefresh and OnAfterDataRefresh. GUI has event handlers for those. ActiveRow is saved in UI in the event handler for OnBeforeDataRefresh and in OnAfterDataRefresh I can restore it if only it is still in the grid (the row could have been deleted in the DB).
Regards
Michał Hofman