B
bernardpace
Hi,
I am having the following situation. The snippet of algorithm shown is
being executed on a new thread.
while (....)
{
.....
.....
myDataGrid.DataSource = myDataTable;
myDataGrid.Refresh();
// Here I need to update some windows components, mainly a datagrid
// Updating it directly from the thread is giving me an error, shown
below
}
Error given: "
An unhandled exception of type 'System.ArgumentException' occurred in
system.windows.forms.dll
Additional information: Controls created on one thread cannot be
parented to a control on a different thread.
"
thread.
Now to solve the problem, I was thinking of make it asynchronously.
Can someone help me out to solve my problem.
Thanks in Advance
I am having the following situation. The snippet of algorithm shown is
being executed on a new thread.
while (....)
{
.....
.....
myDataGrid.DataSource = myDataTable;
myDataGrid.Refresh();
// Here I need to update some windows components, mainly a datagrid
// Updating it directly from the thread is giving me an error, shown
below
}
Error given: "
An unhandled exception of type 'System.ArgumentException' occurred in
system.windows.forms.dll
Additional information: Controls created on one thread cannot be
parented to a control on a different thread.
"
things should not be updated from workers thread but only from the UIFrom previous reads I made, this is happeining due to the fact that UI
thread.
Now to solve the problem, I was thinking of make it asynchronously.
Can someone help me out to solve my problem.
Thanks in Advance