Question

I have a DataGridView on my windows forms and I want to display real time data from a SQL Server database on it. I am using Windows.forms.Timer to fetch data from DB every 1 sec and binding it to DataGrid but some times on doing some other UI operations the Timer.Elapsed is not fired exactly at interval of 1 sec but is queued and 2-3 events fires at a time. Pleas let me know the best way to implement such a scenario

Regards, Harshal

Was it helpful?

Solution

If you're in control of the process that changes the data in the DB I would consider an event driven model instead where you issue an event that the UI can subscribe to when the data changes. That way you can avoid unnecessary polling.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top