WebClient.DownloadStringCompleted WebClient.DownloadStringCompleted WebClient.DownloadStringCompleted WebClient.DownloadStringCompleted Event

Definition

Tritt ein, wenn ein asynchroner Ressourcendownload abgeschlossen wird.Occurs when an asynchronous resource-download operation completes.

public:
 event System::Net::DownloadStringCompletedEventHandler ^ DownloadStringCompleted;
public event System.Net.DownloadStringCompletedEventHandler DownloadStringCompleted;
member this.DownloadStringCompleted : System.Net.DownloadStringCompletedEventHandler 
Public Event DownloadStringCompleted As DownloadStringCompletedEventHandler 

Beispiele

Im folgenden Codebeispiel wird das Festlegen eines Ereignis Handlers für dieses Ereignis veranschaulicht.The following code example demonstrates setting an event handler for this event.

// Sample call : DownloadStringInBackground2 ("http://www.contoso.com/GameScores.html");
void DownloadStringInBackground2( String^ address )
{
   WebClient^ client = gcnew WebClient;
   Uri ^uri = gcnew Uri(address);
   
   // Specify that the DownloadStringCallback2 method gets called
   // when the download completes.
   client->DownloadStringCompleted += gcnew DownloadStringCompletedEventHandler( DownloadStringCallback2 );
   client->DownloadStringAsync( uri );
}


// Sample call : DownloadStringInBackground2 ("http://www.contoso.com/GameScores.html");
public static void DownloadStringInBackground2 (string address)
{
    WebClient client = new WebClient ();
    Uri uri = new Uri(address);

    // Specify that the DownloadStringCallback2 method gets called
    // when the download completes.
    client.DownloadStringCompleted += new DownloadStringCompletedEventHandler (DownloadStringCallback2);
    client.DownloadStringAsync (uri);
}

'  Sample call : DownloadStringInBackground2 ("http:' www.contoso.com/GameScores.html")
Public Shared Sub DownloadStringInBackground2(ByVal address As String)

    Dim client As WebClient = New WebClient()

    '  Specify that the DownloadStringCallback2 method gets called
    '  when the download completes.
    AddHandler client.DownloadStringCompleted, AddressOf DownloadStringCallback2
                Dim uri as Uri = New Uri(address)
    client.DownloadStringAsync(uri)
End Sub

Hinweise

Dieses Ereignis wird jedes Mal ausgelöst, wenn ein asynchroner Vorgang zum Herunterladen einer Ressource als Zeichenfolge abgeschlossen wird.This event is raised each time an asynchronous operation to download a resource as a string completes. Diese Vorgänge werden durch Aufrufen der DownloadStringAsync-Methoden gestartet.These operations are started by calling the DownloadStringAsync methods.

Der DownloadStringCompletedEventHandler ist der Delegat für dieses Ereignis.The DownloadStringCompletedEventHandler is the delegate for this event. Die DownloadStringCompletedEventArgs-Klasse stellt dem Ereignishandler Ereignisdaten bereit.The DownloadStringCompletedEventArgs class provides the event handler with event data.

Weitere Informationen zum Behandeln von Ereignissen finden Sie unter behandeln und Auslösen von Ereignissen.For more information about how to handle events, see Handling and Raising Events.

Gilt für: