Passing Parameters to Threads

It is very common to have methods or procedures that accept parameters. Recall from previous discussions, however, that the procedure that is passed to the thread when it is created cannot have a return value and cannot accept parameters. This complicates your work because you have to find some way to get data into the procedure without using the standard method of passing parameters on the procedure call.

Just as with returning a value, there are two ways to pass parameters to procedures running on other threads: You can use module or global variables, or you can use properties or fields. There are plusses and minuses with each approach, of course. You'll examine both methods now, but understand that your current ...

Get A Programmer's Introduction to Visual Basic® .NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.