PrepAway - Latest Free Exam Questions & Answers

What should you do to configure the application so that the background thread…

You are busy to develop a Microsoft Windows Forms application that performs long- running task that performs in the background thread. The application is of such a kind, that it does not interoperate with Component Object Model {COM}.
What should you do to configure the application so that the background thread can report the status of the task by calling the ReportProgress method of the BackgroundWorker class?

PrepAway - Latest Free Exam Questions & Answers

A.
You should add a ProgressBar control to the form that hosts the BackgroundWorker component.

B.
You should apply the MTATThread attribute to the Main method of the application.

C.
You should apply the STATThread attribute to the Main method of the application.

D.
You should set WorkerReportProgress property of the BackgroundWorker class to true.

Explanation:
You need to set the WorkerReportProgress property of the BackgroundWorker class to true, which will raise the ProgressChange event whenever the ReportProgress method is called.
Incorrect Answers:
A: The ProgressBar should not be added. This also will not report the status of the background task.
B: The MTATThread should not be applied to the Main method. Furthermore, the application does not interoperate with COM.
C: The STATThread should not be applied to the Main method. It is there by default.
E: Request the status of a background process by using the BackgroundWorker component.


Leave a Reply