Reputation: 1589
I have a datagridview that is connected to a table. The datagridview changes when certain actions are made, but I would like it to refresh (i.e. reload the grid from a datatable that I create) even if the user isn't doing anything so the data the user sees is up to date. What is the best way to do this? Thanks!
Upvotes: 1
Views: 529
Reputation: 3688
Try using a timer like this
private void Form1_Load(object sender, EventArgs e)
{
Timer timer = new Timer();
timer.Interval=1000; // time in milliseconds
timer.Tick+=new EventHandler(timer_Tick);
}
void timer_Tick(object sender, EventArgs e)
{
//Do your update here
}
Upvotes: 1