Understanding Multithreading
Ok, I got the basic concept down:
Sub LoopThread()
'Code for Thread
End Sub
Sub Main()
Dim myThread As Thread
myThread = New Thread(AddressOf LoopThread)
myThread.Start()
End Sub
What I want to know is if you can pass the LoopThread any variables? I seem to get an error message whenever I try:
Sub LoopThread(ByVal x As Short)
'Code
end Sub
I get a blue line under LoopThread on the following line:
myThread = New Thread(AddressOf LoopThread)
Something about the wrong signature...
This didn't work either:
myThread = New Thread(AddressOf LoopThread(x))
Is the only way to pass it a variable by using a global? I hope not.