BackgroundWorker.ReportProgress Method (Int32, Object)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Raises the ProgressChanged event.
Assembly: System (in System.dll)
'Declaration Public Sub ReportProgress ( _ percentProgress As Integer, _ userState As Object _ )
Parameters
- percentProgress
- Type: System.Int32
The percentage, from 0 to 100, of the background operation that is completed.
- userState
- Type: System.Object
The state object passed to RunWorkerAsync.
| Exception | Condition |
|---|---|
| InvalidOperationException | The WorkerReportsProgress property is set to false. |
If you need the background operation to report on its progress, you can call the ReportProgress method to raise the ProgressChanged event. The WorkerReportsProgress property value must be true, or ReportProgress 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.