I have a wingrid that I have bound to SQL Server via the Ultragrid designer.
Need this grid to refresh data from database every 5 seconds or so. I do not wish to lose layout and other local user preferences like column filters, sorts, row and cell selections.
Tried all the advises from other posts on this topic including these below:
UltraGrid1.Rows.Refresh(RefreshRow.ReloadData, True)
UltraGrid1.Databind()
Me.SecuritiesTableAdapter.Fill(Me.DsSecurities.Securities)
The last one works in that it refreshes the data but unfortunately loses the local user preferences that I mentioned earlier.
Is there any oher way I can reload data but still keep the user experience constant?
Thanks!
Solved!
Used the adapter.fill method (3rd one from above) and reset the active cell and active row through
Me.UltraGrid1.Rows(currentActivatedCell.Row.Index).Cells(currentActivatedCell.Column.Index).Activate()
AND
UltraGrid1.ActiveRowScrollRegion.FirstRow
PS: currentActivatedCell is a local variable saved prior to data refresh.
Thank you
just a quick thought.. i donno if it's usefull for refreshing every 5s, i would save the layout of the grid in a memorystream before update and re-apply it after update..