WebClient.DownloadStringCompleted Ereignis

Definition

Tritt ein, wenn ein asynchroner Ressourcendownload abgeschlossen wird.

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

Ereignistyp

DownloadStringCompletedEventHandler

Beispiele

Im folgenden Codebeispiel wird das Festlegen eines Ereignishandlers für dieses Ereignis veranschaulicht.

// 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 ausgelöst wird, um eine Ressource als Zeichenfolge herunterzuladen. Diese Vorgänge werden gestartet, indem sie die DownloadStringAsync Methoden aufrufen.

Dies DownloadStringCompletedEventHandler ist die Stellvertretung für dieses Ereignis. Die DownloadStringCompletedEventArgs Klasse stellt den Ereignishandler mit Ereignisdaten bereit.

Weitere Informationen zum Behandeln von Ereignissen finden Sie unter behandeln und Auslösen von Ereignissen.

Gilt für