Home > Net >  C #, multithreading issues about the background
C #, multithreading issues about the background

Time:09-29

Hope to get return an online some directions
Novice self-taught, just learn to use a background thread processing,
Then in the same way want to edit the second background threads,
The Lao shifu excuse me, where is need to pay attention to matters, and how to solve the

CodePudding user response:

Suggest that look at the example of the ms program
Defined also have the new object out
 
BackgroundWorker1=new BackgroundWorker ();//new BackgroundWorker
BackgroundWorker1. WorkerReportsProgress=true;//allow progress report
BackgroundWorker1. WorkerSupportsCancellation=true;//allow cancel the thread
BackgroundWorker1. DoWork +=worker_DoWork;//set the main logic
BackgroundWorker1. ProgressChanged +=worker_ProgressChanged;//schedule change related processing
BackgroundWorker1. RunWorkerCompleted +=worker_RunWorkerCompleted;//thread to complete the processing of

CodePudding user response:

You don't instantiate the object

CodePudding user response:

Not instantiate objects, it is recommended that the first look at examples of multithreading, and then apply,

CodePudding user response:

Objects need to be initialized, https://docs.microsoft.com/zh-cn/dotnet/csharp/

CodePudding user response:

reference sxty0220 reply: 3/f
not instantiate objects, suggest to look at the example of a multithreaded, and then apply,
my has successfully generated to me the first background thread designer copy and paste to the second process is instantiated object
  •  Tags:  
  • C#