Thread Results

  • Thread starter Thread starter Mythran
  • Start date Start date
M

Mythran

I have a thread which executes database manipulation code. I need to display the
resulting dataset into a datagrid which is located on my main form (created by
the main thread, not the child thread that created the dataset). When I try to
bind the results to the datagrid, I get the following exception:

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.

Can anyone help me get the resulting data from the child thread to the main
thread so I can successfully display the results???

Thanks much :)

Mythran
 
* "Mythran said:
I have a thread which executes database manipulation code. I need to display the
resulting dataset into a datagrid which is located on my main form (created by
the main thread, not the child thread that created the dataset). When I try to
bind the results to the datagrid, I get the following exception:

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.

Can anyone help me get the resulting data from the child thread to the main
thread so I can successfully display the results???

Have a look at 'Control.Invoke', 'Control.BeginInvoke', and 'Control.EndInvoke'.
 
Back
Top