Did you know that you could launch threads to handle background tasks in .NET? Was the explanation of passing parameters to launched threads clear? Were you aware that you should not access Windows controls directly from any thread other than the thread on which they were created? Did this article help explain why? Let us know in the
How To Pass Parameters to Threads in Windows Forms Applicationsand 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.
by Russell Jones
March 10, 2003
he .NET framework makes it easy to start code execution on a new threadimproving user interface design by letting you execute lengthy procedures on one thread while leaving the UI thread active and available to handle user interaction.
Starting a new thread is simple in VB.NETyou add the System.Threading namespace to your module to simplify naming, create a new thread using a delegate to tell it which method to start in, and then call its Start method to begin execution.
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!