Hello,
I have a thread intensive C# .NET application in which there are two main threads. I have just migrated this application from .NET 1.1 to .NET 2.0 framework. It works perfectly under .NET 1.1
Thread 1 - manages the state of the application.
Thread 2 - creates and updates the controls
In thread 2, the controls are being updated in a thread-safe manner using the Invoke calls since the trigger to update the controls may come from Thread 1. For some reason, the Invoke mechanism doesnt work. I have also tried using the BeginInvoke instead of Invoke, but it doesnt work. Due to this, the application hangs in the Thread 1 because Thread 2 does not update the control and return. It would be great if there is a solution to this issue!
Loading
Harish IyerPosted Aug 8, 2009, 12:15 AM
I got the answer for my problem. The problem is due to the delayed handle creation for the control. All I had to do was to make sure that the control's handle was created before I used Invoke. The problem is explained well below. I just read it and used it my application and guess what, it worked :).
http://msmvps.com/blogs/nickwienholt/archive/2004/08/18/12023.aspx
All you have to do is force the creation of the handle, as simple as that.
Danatas GerviPosted Aug 4, 2009, 12:31 PM
(from other thread)
Danatas GerviPosted Aug 4, 2009, 12:28 PM
in else - you will be in main thread, and can do what you want.