Skip to main content

Multi-Threaded Applications in Visual Basic

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...

  1. Imports System.Threading

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.

  1. 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...

  1. trd.Start()

runThread Function:
Finally we can create our 'runThread' function which is the 'addressOf' our new thread, 'trd'...

  1. Private Function runThread()
  2. MsgBox("Hi there!")
  3. End Function

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.