System.ComponentModel.BackgroundWorker.ReportProgress Method

Raises the BackgroundWorker.ProgressChanged event.

Syntax

public void ReportProgress (int percentProgress)

Parameters

percentProgress
The percentage, from 0 to 100, of the background operation that is complete.

Remarks

If you need the background operation to report on its progress, you can call the BackgroundWorker.ReportProgress(int) method to raise the BackgroundWorker.ProgressChanged event. The BackgroundWorker.WorkerReportsProgress property value must be true, or BackgroundWorker.ReportProgress(int) will throw an InvalidOperationException.

It is up to you to implement a meaningful way of measuring your background operation's progress as a percentage of the total task completed.

The call to the BackgroundWorker.ReportProgress(int) method is asynchronous and returns immediately. The BackgroundWorker.ProgressChanged event handler executes on the thread that created the System.ComponentModel.BackgroundWorker.

Requirements

Namespace: System.ComponentModel
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0