WebClient.OpenWriteCompleted イベント

定義

リソースにデータを書き込むためにストリームを開く非同期操作の完了時に発生します。

public:
 event System::Net::OpenWriteCompletedEventHandler ^ OpenWriteCompleted;
public event System.Net.OpenWriteCompletedEventHandler? OpenWriteCompleted;
public event System.Net.OpenWriteCompletedEventHandler OpenWriteCompleted;
member this.OpenWriteCompleted : System.Net.OpenWriteCompletedEventHandler 
Public Custom Event OpenWriteCompleted As OpenWriteCompletedEventHandler 
Public Event OpenWriteCompleted As OpenWriteCompletedEventHandler 

イベントの種類

OpenWriteCompletedEventHandler

次のコード例は、このイベントのイベント ハンドラーを設定する方法を示しています。

void OpenResourceForWriting2( String^ address )
{
   WebClient^ client = gcnew WebClient;
   Uri ^uri = gcnew Uri(address);

   // Specify that the OpenWriteCallback method gets called
   // when the writeable stream is available.
   client->OpenWriteCompleted += gcnew OpenWriteCompletedEventHandler( OpenWriteCallback2 );
   client->OpenWriteAsync( uri, "POST" );

   // Applications can perform other tasks
   // while waiting for the upload to complete.
}
public static void OpenResourceForWriting2(string address)
{
    WebClient client = new WebClient();
    Uri uri = new Uri(address);

    // Specify that the OpenWriteCallback method gets called
    // when the writeable stream is available.
    client.OpenWriteCompleted += new OpenWriteCompletedEventHandler(OpenWriteCallback2);
    client.OpenWriteAsync(uri, "POST");
    // Applications can perform other tasks
    // while waiting for the upload to complete.
}
Public Shared Sub OpenResourceForWriting2(ByVal address As String)

    Dim client As WebClient = New WebClient()

    '  Specify that the OpenWriteCallback method gets called
    '  when the writeable stream is available.
    AddHandler client.OpenWriteCompleted, AddressOf OpenWriteCallback2
                Dim uri as Uri = New Uri(address)
    client.OpenWriteAsync(uri, "POST")
    '  Applications can perform other tasks
    '  while waiting for the upload to complete.
End Sub

注釈

このイベントは、リソースにデータを送信するために使用されるストリームを開く非同期操作が完了するたびに発生します。 これらの操作は、メソッドを OpenWriteAsync 呼び出すことによって開始されます。

OpenWriteCompletedEventHandlerこのイベントのデリゲートは次のようになります。 このクラスは OpenWriteCompletedEventArgs 、イベント データをイベント ハンドラーに提供します。

イベントを処理する方法の詳細については、次を参照してください。処理とイベントの発生します。

適用対象