I just posted a question about how to get a delegate to update a textbox on another form. Just when I thought I had the answer using Invoke...this happens. Here is my code:<
I have solved this in the past using the following method:
private void invokeOnFormThread(MethodInvoker method)
{
if (IsHandleCreated)
Invoke(new EventHandler(delegate { method(); }));
else
method();
}
Call invokeOnFormThread instead of Invoke. It will only use the form's thread if a handle has already been created, otherwise it will use the caller's thread.