Wednesday, May 18, 2005

How To Pass Parameters to Threads in Windows Forms Applications and Get Results

How To Pass Parameters to Threads in Windows Forms Applications and Get Results

"Launching new threads is easy, but it's not as obvious how you can pass parameters to the threads and get the results back. In addition, accessing Windows Forms controls from multiple threads can cause problems. In this article, you'll see how to pass parameters, receive results, and access controls safely from multiple threads in a Windows Forms application. ..."

I've tried to stay away from multi-threaded app development, not really needing them and not finding a true use case where they were worth the possible problems (yeah, I got bit by the Daniel Appleman's Multi-threading bug...). It's amazing what you can do with just raising a few events and so much easier than dealing with thread sync'ing/safety, etc, etc. "We don't need no stink'n multithreading..." ;)

But that's changing with some of the apps I'm now writing. I hope I can hold off till .Net 2.0, but we'll see...

Anyway this looks like a good article on the subject that I want to review in detail.

No comments: