Ron Kidd
asked on
Loop through Multiple Processes Async
Hello
I have a Program that needs to Generate pdf files (Invoices) for emailing.
I can have up to 50 pdf files to Generate per Email.
I want to loop through all the Files and Generate 5 Async until all files are generated.
i.e. I want 5 pdf files being generated continually until all the files have been generated. (As soon as one finishes I want another one to start - Keeping 5 Being generated)
How do I do this?
Currently I have the Below.
I have a Program that needs to Generate pdf files (Invoices) for emailing.
I can have up to 50 pdf files to Generate per Email.
I want to loop through all the Files and Generate 5 Async until all files are generated.
i.e. I want 5 pdf files being generated continually until all the files have been generated. (As soon as one finishes I want another one to start - Keeping 5 Being generated)
How do I do this?
Currently I have the Below.
Dim fileList As New List(Of String)
' Code to Populate List
For Each item In fileList
'Generate PDF of Order
Dim processToStart As New ProcessStartInfo
processToStart.FileName = "C:\PDFProgram.exe"
processToStart.Arguments = item
processToStart.UseShellExecute = False
Process.Start(processToStart).WaitForExit()
Next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks very much for that