WebClient.DownloadStringCompleted イベント
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
非同期のリソース ダウンロード操作の完了時に発生します。
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
イベントの種類
例
次のコード例は、このイベントのイベント ハンドラーを設定する方法を示しています。
// 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
注釈
このイベントは、文字列としてリソースをダウンロードする非同期操作が完了するたびに発生します。 これらの操作は、メソッドを DownloadStringAsync 呼び出すことによって開始されます。
この DownloadStringCompletedEventHandler イベントのデリゲートです。 このクラスは DownloadStringCompletedEventArgs 、イベント データをイベント ハンドラーに提供します。
イベントを処理する方法の詳細については、次を参照してください。処理とイベントの発生します。