I have an application that needs to run subs simultaneously - possibly 2 or 3 instances at a time - which might take a few seconds to process. The Sub requires variables so it cannot be a straightforward thread request.
I'm not sure a backgroundWorker is the answer since I think it needs to finish running before it can be run again?
I found some code that uses threads but it completely crashes the entire application which shuts itself down. The application imports System.Threading etc.
The code used to run the sub is as follows.
Expand|Select|Wrap|Line Numbers
- Dim mySub As New Thread(DirectCast(Sub() processVal(thisval), ThreadStart))
- mySub.Start()
Are there some extra requirements, imports etc that I should be aware of when using this type of threading procedure? Or a better way to have simultaneous subs running?
Thanks
EDIT: Is there maybe some kind of Async method to do this?