Submitted by Yorkiebar on Thursday, April 17, 2014 - 09:41.
This tutorial is on how to create a multi-threaded application in Visual Basic.
There really is no design needed for this application, although if you wanted to, you can add a button.
What Is a Thread?
A thread is the part of your .NET program which runs everything else, your UI, your functions and your classes. Without a thread, your program would not be able to run.
Why Multiple Threads?
Once a thread has a lot of processing to do, problems begin to arrise. The main problem you may see, is your UI freezing. Creating a thread is very easy and should be done to handle any large or process hogging processes.
To create a new thread, we must import the namespace...
Creating a Thread:
Now, to create a thread we create an object as thread, then assign it to a new thread. A new thread requires one parameter which is 'AddressOf' followed by the function to run once the thread is started.
Dim trd As Thread = New Thread(AddressOf runThread)
Starting a Thread:
Once the thread is created, we can start it running the 'AddressOf' function by invoking its 'Start' function...
Finally we can create our 'runThread' function which is the 'addressOf' our new thread, 'trd'...