Refreshing a DataGridView On a Timer

  • Thread starter Thread starter Rigamonk
  • Start date Start date
R

Rigamonk

Guest
I have a DataGridView I would like to refresh every x amount of seconds. I can refresh easy enough using a button_click:

private void CmdRefesh_Click(object sender, EventArgs e)
{
pMF_ToolingRequestsTableAdapter.Fill(this.activeRequestsDataSet.PMF_ToolingRequests);

DgvRequests.Parent.Refresh();
}


but when I call it from a system.timers.timer (in a cross-thread call), it doesnt refresh the UI at all by adding any additional rows. Heres what Im using:

private void OnTimedEvent(object sender, ElapsedEventArgs e)
{
pMF_ToolingRequestsTableAdapter.Fill(this.activeRequestsDataSet.PMF_ToolingRequests);

BeginInvoke(new MethodInvoker(delegate{ DgvRequests.Update(); }));
BeginInvoke(new MethodInvoker(delegate { DgvRequests.Parent.Refresh(); }));
}


why doesnt it add rows to the UI?

Continue reading...
 
Back
Top