can't solve Cross Threading on DataGrid Control

  • Thread starter Thread starter oniks993
  • Start date Start date
O

oniks993

Guest
Hi I have C# application that connects to Database By Linq to SQL and the tables I get from Database I view them on DataGrid Control and I need to refresh this dataGrid every 30 seconds. so I create Method thats Refreshes datagrid ( makes request from Database ) . and used datagrid.invoke () to use it Asynchoronously , so id didnt stuck the application while it returns results, but It doesnt work, as I see it uses same thread again

here is code :


DatagridView1.Begininvoke ( new MethodInvoker ( ()=>

{ while (true)

{

datagridView.refresh();

thread.sleep(30000);

}}

) );


so when I run the code it stucks , any suggestions ? thank you

Continue reading...
 
Back
Top