Reputation: 1300
I am writing a vb.net/WPF program that will have a datagrid. Multiple people will be using this program at the same time so I need to try to keep everyone's datagrid refreshed and matching. I am not sure how to go about doing this. I thought I would set a background worker to every so often just refresh the datatable and refill the datagrid. I am not sure if this is the best strategy so am looking to SO for suggestions. One of the problems I have with this method is that when the datagrid is refilled it loses any sorting that the user may have applied.
Upvotes: 1
Views: 68
Reputation: 300549
A periodic polled refresh and a manual refresh button are commonly used.
Another option (assuming you are targeting SQL Server) is to use SqlDependency
to 'tell' you when data changes rather than polling.
The accepted answer here describes some approaches.
Using SqlDependency in a Windows Application
Upvotes: 1