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

정의

비동기 리소스 다운로드 작업이 완료되면 발생합니다.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 

예제

다음 코드 예제에서는이 이벤트에 대 한 이벤트 처리기를 설정 하는 방법을 보여 줍니다.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

설명

이 이벤트는 문자열로 나타낸 리소스를 다운로드 하는 비동기 작업이 완료 될 때마다 발생 합니다.This event is raised each time an asynchronous operation to download a resource as a string completes. 호출 하 여 이러한 작업은 DownloadStringAsync 메서드.These operations are started by calling the DownloadStringAsync methods.

DownloadStringCompletedEventHandler 는이 이벤트에 대 한 대리자입니다.The DownloadStringCompletedEventHandler is the delegate for this event. DownloadStringCompletedEventArgs 클래스는 이벤트 데이터를 사용 하 여 이벤트 처리기를 제공 합니다.The DownloadStringCompletedEventArgs class provides the event handler with event data.

이벤트를 처리 하는 방법에 대 한 자세한 내용은 참조 하세요. 이벤트 처리 및 발생합니다.For more information about how to handle events, see Handling and Raising Events.

적용 대상