M
Montaque
//Refersh the datagrid automatically.however,the callback function test() is not been invoked. any suggestions?
the following lists the code
private void AutoRefreshData()
{
System.Threading.Timer c=new System.Threading.Timer(new TimerCallback(this.refreshdata),this,0,1000);
}
private void refreshdata(Object Data)
{
this.Invoke(new InvokeFormOwn(this.test));
}
private delegate void InvokeFormOwn();
private void test()
{
this.dataGrid1.DataSource=null;
this.dataGrid1.DataSource=OrderSystem.GetInstance().GetAllOrderItems();
}
the following lists the code
private void AutoRefreshData()
{
System.Threading.Timer c=new System.Threading.Timer(new TimerCallback(this.refreshdata),this,0,1000);
}
private void refreshdata(Object Data)
{
this.Invoke(new InvokeFormOwn(this.test));
}
private delegate void InvokeFormOwn();
private void test()
{
this.dataGrid1.DataSource=null;
this.dataGrid1.DataSource=OrderSystem.GetInstance().GetAllOrderItems();
}