Hi,
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 backgroundWorke r 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.Threadin g etc.
The code used to run the sub is as follows.
The sub processVal runs some calcs and requests data from a 3rd party site.
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?
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 backgroundWorke r 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.Threadin g etc.
The code used to run the sub is as follows.
Code:
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?
Comment