I am attempting to make a program which updates the GUI with new data every 30 seconds. I currently have it so you can click a button to update the data values, but I want the finished product to automatically update. I am sure that it is a simple addition, perhaps with the addition of the backgroundWorker class? Or have something generate an event, which would be handled the same way the buttonClicked action listener is working. What would be the best way to go about this?
Share
You have to consider how long will takes fetching the data from the real DataSource. This because if you use a Winform Timer, during the timer event processing the UI will not respond to other user events, so if this is a long process the user experience became poor. Using a background worker thread would be a good strategy, but in this case you have to update the UI via Control.Invoke, or by using the
PreogressChangedevent. In my opinion, the second option (BackgroundWorker) is better.