DownloadStringCompletedEventHandler デリゲートとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DownloadStringCompletedEventHandler デリゲートの意味・解説 

DownloadStringCompletedEventHandler デリゲート

メモ : このデリゲートは、.NET Framework version 2.0新しく追加されたものです。

WebClient の DownloadStringCompleted イベント処理するメソッド表します

名前空間: System.Net
アセンブリ: System (system.dll 内)
構文構文

Public Delegate Sub DownloadStringCompletedEventHandler
 ( _
    sender As Object, _
    e As DownloadStringCompletedEventArgs _
)
Dim instance As New DownloadStringCompletedEventHandler(AddressOf
 HandlerMethod)
public delegate void DownloadStringCompletedEventHandler
 (
    Object sender,
    DownloadStringCompletedEventArgs e
)
public delegate void DownloadStringCompletedEventHandler
 (
    Object^ sender, 
    DownloadStringCompletedEventArgs^ e
)
/** @delegate */
public delegate void DownloadStringCompletedEventHandler
 (
    Object sender, 
    DownloadStringCompletedEventArgs e
)
JScript では、デリゲート使用できますが、新規に宣言することはできません。

パラメータ

sender

イベントソース

e

イベント データ格納している DownloadStringCompletedEventArgs。

解説解説
使用例使用例

非同期に文字列をダウンロードするコード例次に示します

'  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

// 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);
}

ダウンロード完了する次のメソッド呼び出されます。

Public Shared Sub DownloadStringCallback2(ByVal
 sender As Object, ByVal
 e As DownloadStringCompletedEventArgs)

    '  If the request was not canceled and did not throw
    '  an exception, display the resource.
    If e.Cancelled = False AndAlso
 e.Error Is Nothing Then

        Dim textString As String
 = CStr(e.Result)
        Console.WriteLine(textString)
    End If
End Sub

public static void DownloadStringCallback2
 (Object sender, DownloadStringCompletedEventArgs e)
{
    // If the request was not canceled and did not throw
    // an exception, display the resource.
    if (!e.Cancelled && e.Error == null)
    {
        string textString = (string)e.Result;

        Console.WriteLine (textString);
    }
}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からDownloadStringCompletedEventHandler デリゲートを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDownloadStringCompletedEventHandler デリゲートを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDownloadStringCompletedEventHandler デリゲート を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DownloadStringCompletedEventHandler デリゲート」の関連用語

DownloadStringCompletedEventHandler デリゲートのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DownloadStringCompletedEventHandler デリゲートのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS