question

WelchPKG avatar image
0 Votes"
WelchPKG asked lextm commented

Can you have more than one backgroundworker run at one time

I just recently found this object called backgroundworker. I am using it to do large imports while keeping the user updated on the process via the UI. I have several programs that need to do more than one large import and I would like to run them at the same time. When I try to use more than 1 background worker at the same time, when the first one gets done the second one stops working. Is there away to have more than 1 background worker run at the same time and have both complete when they are done with each of their tasks?

dotnet-csharp
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello I am anthony I have an exe that I need to see it's source code can you help me?

0 Votes 0 ·

Hello I am anthony I have an exe that I need to see it's source code can you help me?

0 Votes 0 ·

Some example here.

0 Votes 0 ·

1 Answer

karenpayneoregon avatar image
0 Votes"
karenpayneoregon answered

Your best option is to not use the BackGroundWorker but instead use Task-based asynchronous programming where multiple operations can run at the same time.

Task based operations can be setup for cancellation, work with events and Interface such as IProgress (see also Reporting Progress from Async Tasks).

Bottom line is task base programming asynchronously you have more control than with a BackGroundWorker component.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.