Public Class Class1
Dim thread As New System.Threading.Thread(AddressOf AMethod)
thread.Start()
Public Sub AMethod()
Console.writeline("Thread start")
End Sub
End Class
The "thread.Start()" is the problematic line, according to vb. Declaring the thread in a sub gives an overload error, whatever that means.
If you didn't understand what @Plutonix meant by "executable code floating around" (I love that phrase) here is an example:
Public Class Class1
Dim thread As New System.Threading.Thread(AddressOf AMethod)
Public Sub StartingThread()
thread.Start()
End Sub
Public Sub AMethod()
Console.WriteLine("Thread start")
End Sub
End Class
See, the executable code thread.Start() is now inside a method. I, myself, am steering clear of threading until I know much more about it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.