G
Guest
Just want to report an error on the KB article Q318607, which is last
reviewed at September 15, 2005.
How to populate the datagrid on background thread with data
binding by using Visual C#.
In the example, QueryDataBase is called within the new thread, and
the function call MyForm.label1.Text violates the cross-thread principle.
It doesn't blow up in .NET 2003 but it gives InvalidOperation in .NET 2005.
static void QueryDataBase()
{
MyDataSet = new DataSet();
MyConnection.Open();
MyDataAdapter = new SqlDataAdapter(MyQueryString, MyConnection);
MyForm.label1.Text = "Filling the DataSet";
MyDataAdapter.Fill(MyDataSet, "MyTable");
MyConnection.Close();
MyForm.label1.Text = "DataSet Filled";
MyForm.BeginInvoke(CallDataBindToDataGrid);
}
Regards
Stan.
reviewed at September 15, 2005.
How to populate the datagrid on background thread with data
binding by using Visual C#.
In the example, QueryDataBase is called within the new thread, and
the function call MyForm.label1.Text violates the cross-thread principle.
It doesn't blow up in .NET 2003 but it gives InvalidOperation in .NET 2005.
static void QueryDataBase()
{
MyDataSet = new DataSet();
MyConnection.Open();
MyDataAdapter = new SqlDataAdapter(MyQueryString, MyConnection);
MyForm.label1.Text = "Filling the DataSet";
MyDataAdapter.Fill(MyDataSet, "MyTable");
MyConnection.Close();
MyForm.label1.Text = "DataSet Filled";
MyForm.BeginInvoke(CallDataBindToDataGrid);
}
Regards
Stan.