I am working on a project in C# at the moment which is quite simple.
I have a status box, two buttons and a dataGridView.
When the Form loads the dataGridView is filled correctly.
What I would like to do is then update that table every 45 seconds to reflect any changes in the database.
I am looking for suggestions on a technique to achieve this. I have been searching for clear information but it seems somewhat lacking.
Timercontrol to your form. (It’s in the components category)Intervalproperty to45000(the value represents milliseconds)Enabledproperty of the timer toTruein the form designer, or somewhere in your code.Tickevent (you can get this by double-clicking the timer)Tickhandler, update yourdataGridViewYour handler will look like this:
If you need to suspend updates for some reason, you can call
timer1.Stop()to stop the timer from running, and usetimer1.Start()to start it up again.