WebClient.OpenWriteCompleted イベント

定義

リソースにデータを書き込むためにストリームを開く非同期操作の完了時に発生します。Occurs when an asynchronous operation to open a stream to write data to a resource completes.

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

次のコード例は、このイベントのイベントハンドラーを設定する方法を示しています。The following code example demonstrates setting an event handler for this event.

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

注釈

このイベントは、リソースへのデータの送信に使用されるストリームを非同期操作が完了するたびに発生します。This event is raised each time an asynchronous operation to open a stream that is used to send data to a resource completes. これらの操作は、メソッドを呼び出すことによって開始され OpenWriteAsync ます。These operations are started by calling the OpenWriteAsync methods.

は、 OpenWriteCompletedEventHandler このイベントのデリゲートです。The OpenWriteCompletedEventHandler is the delegate for this event. クラスは、イベント OpenWriteCompletedEventArgs データを含むイベントハンドラーを提供します。The OpenWriteCompletedEventArgs class provides the event handler with event data.

イベントを処理する方法の詳細については、次を参照してください。処理とイベントの発生します。For more information about how to handle events, see Handling and Raising Events.

適用対象