How does it work in this scenario? WinApp creates object, Object creates thread for internal work, The internal work call Methods witin the object to process data, (is this bad, calling methods in an object from a thread method call?) Sometimes the object in turn fires an event for the WinApp to receive, In the event handler in the WinApp I update a text box.
What thread is doing the update? Do I have to use control.invoke here? What if I don't, what the worst that could happen? Secondly, are there examples of what goes wrong when you don't use control.invoke. I used to rememeber that all code examples came with 2 examples. One example showed what would go wrong when you do something a certain way and then it would show the correct way. The wrong way made it very easy to understand what was going on. Thanks, Michael ----- Original Message ----- From: "Jacob Grass" <[EMAIL PROTECTED]> Sent: Thursday, June 20, 2002 8:54 AM Subject: Re: WindowsForms don't works correctly with multithreading? If you are going to update the UI from a thread which does not own the UI elements, you need to use Control.Invoke to marshal between the threads. Jacob A. Grass -----Original Message----- From: Luca Marchesi [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 20, 2002 5:01 AM To: [EMAIL PROTECTED] Subject: [DOTNET] WindowsForms don't works correctly with multithreading? You know that WindowsForms applications must run in a STA apartment, because of the underlying technologies such as OLE that requires STA. Some days ago I read that ThreadPool uses a MTA apartment (obvoiusly): are there any problems in using WindowsForms with ThreadPool? Moreover: a control can be accessed only by the thread that created it. If in a WindowsForms app I start a new thread and that thread modifies something in the forms what happens? A thread handler run inside the thread that fired the event: if the form handle an event raised by an other thread and the event handler modifies some properties of the form itself, are tehere any conflicts? In short: are there any conflicts in working with multithreading WIndowsForms apps? If so, which? Thanks, Luca You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.