WebClient.UploadDataCompleted WebClient.UploadDataCompleted WebClient.UploadDataCompleted WebClient.UploadDataCompleted Event

Définition

Se produit lors d'une opération asynchrone de transfert de données.Occurs when an asynchronous data-upload operation completes.

public:
 event System::Net::UploadDataCompletedEventHandler ^ UploadDataCompleted;
public event System.Net.UploadDataCompletedEventHandler UploadDataCompleted;
member this.UploadDataCompleted : System.Net.UploadDataCompletedEventHandler 
Public Custom Event UploadDataCompleted As UploadDataCompletedEventHandler 

Exemples

L’exemple de code suivant illustre la définition d’un gestionnaire d’événements pour cet événement.The following code example demonstrates setting an event handler for this event.

void UploadDataInBackground3( String^ address )
{
   WebClient^ client = gcnew WebClient;
   Uri ^uri = gcnew Uri(address);
   String^ text = "Time = 12:00am temperature = 50";
   array<Byte>^data = System::Text::Encoding::UTF8->GetBytes( text );

   client->UploadDataCompleted += gcnew UploadDataCompletedEventHandler( UploadDataCallback3 );
   client->UploadDataAsync( uri, data );
}


public static void UploadDataInBackground3 (string address)
{
    WebClient client = new WebClient ();
    Uri uri = new Uri(address);
    string text = "Time = 12:00am temperature = 50";
    byte[] data = System.Text.Encoding.UTF8.GetBytes (text);

    client.UploadDataCompleted += new UploadDataCompletedEventHandler (UploadDataCallback3);
    client.UploadDataAsync (uri, data);
}

Public Shared Sub UploadDataInBackground3(ByVal address As String)

	Dim client As WebClient = New WebClient()
	Dim text As String = "Time = 12:00am temperature = 50"
	Dim data() As Byte = System.Text.Encoding.UTF8.GetBytes(text)
	AddHandler client.UploadDataCompleted, AddressOf UploadDataCallback3
                      Dim uri as Uri = New Uri(address)
	client.UploadDataAsync(uri, data)
End Sub

Remarques

Cet événement est déclenché chaque fois une opération de transfert de données asynchrone.This event is raised each time an asynchronous data upload operation completes. Les transferts de données asynchrones sont démarrés en appelant le UploadDataAsync méthodes.Asynchronous data uploads are started by calling the UploadDataAsync methods.

Le UploadDataCompletedEventHandler est le délégué de cet événement.The UploadDataCompletedEventHandler is the delegate for this event. Le UploadDataCompletedEventArgs classe fournit le Gestionnaire d’événements avec les données d’événement.The UploadDataCompletedEventArgs class provides the event handler with event data.

Pour plus d’informations sur la façon de gérer les événements, consultez gestion et déclenchement d’événements.For more information about how to handle events, see Handling and Raising Events.

S’applique à