Muokkaa

Jaa


BackgroundWorker.ProgressChanged Event

Definition

Occurs when ReportProgress(Int32) is called.

public:
 event System::ComponentModel::ProgressChangedEventHandler ^ ProgressChanged;
public event System.ComponentModel.ProgressChangedEventHandler ProgressChanged;
public event System.ComponentModel.ProgressChangedEventHandler? ProgressChanged;
member this.ProgressChanged : System.ComponentModel.ProgressChangedEventHandler 
Public Custom Event ProgressChanged As ProgressChangedEventHandler 

Event Type

Examples

The following code example demonstrates the use of the ProgressChanged event to report the progress of an asynchronous operation to the user. This code example is part of a larger example provided for the BackgroundWorker class.

// This event handler updates the progress bar.
void backgroundWorker1_ProgressChanged( Object^ /*sender*/, ProgressChangedEventArgs^ e )
{
   this->progressBar1->Value = e->ProgressPercentage;
}
// This event handler updates the progress bar.
private void backgroundWorker1_ProgressChanged(object sender,
    ProgressChangedEventArgs e)
{
    this.progressBar1.Value = e.ProgressPercentage;
}
' This event handler updates the progress bar.
Private Sub backgroundWorker1_ProgressChanged( _
ByVal sender As Object, ByVal e As ProgressChangedEventArgs) _
Handles backgroundWorker1.ProgressChanged

    Me.progressBar1.Value = e.ProgressPercentage

End Sub

Remarks

This event is raised when you call the ReportProgress method.

For more information about how to handle events, see Handling and Raising Events.

Applies to

See also