all groups > dotnet academic > april 2006 >
You're in the

dotnet academic

group:

Timer Thread


Timer Thread Neo
4/4/2006 5:28:02 AM
dotnet academic: Hi,
I have a query that takes over a minute to execute so I want to put a timer
on the form while its running. Both procedures work individually, but when I
try to create a thread i get this error:

* Additional information: Controls created on one thread cannot be parented
to a control on a different thread.

Which should be the main thread and which should run in the background?
Right now the query is attempting to run in the background but as soon as I
set the table styles for the datagrid;
dgDisplay.TableStyles.Add(dgts)

i receive the error (*). Any suggestions?
Thanks


Re: Timer Thread Paul Henderson
4/10/2006 8:22:50 AM
[quoted text, click to view]

Assuming you create all your controls in the GUI thread, you should
then be able to execute method calls on them from another thread by
calling the Invoke method on the GUI objects, passing a delegate to the
relevant method you want run.
AddThis Social Bookmark Button