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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.