UploadStringCompletedEventHandler UploadStringCompletedEventHandler UploadStringCompletedEventHandler UploadStringCompletedEventHandler Delegate

Definition

Stellt die Methode zur Behandlung des UploadStringCompleted-Ereignisses eines WebClient-Objekts dar.Represents the method that will handle the UploadStringCompleted event of a WebClient.

public delegate void UploadStringCompletedEventHandler(System::Object ^ sender, UploadStringCompletedEventArgs ^ e);
public delegate void UploadStringCompletedEventHandler(object sender, UploadStringCompletedEventArgs e);
type UploadStringCompletedEventHandler = delegate of obj * UploadStringCompletedEventArgs -> unit
Public Delegate Sub UploadStringCompletedEventHandler(sender As Object, e As UploadStringCompletedEventArgs)

Parameter

sender
Object Object Object Object

Die Quelle des Ereignisses.The source of the event.

Vererbung
UploadStringCompletedEventHandlerUploadStringCompletedEventHandlerUploadStringCompletedEventHandlerUploadStringCompletedEventHandler

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, eine Zeichenfolge asynchron hochladen.The following code example demonstrates asynchronously uploading a string.

void UploadStringInBackground2( String^ address )
{
   WebClient^ client = gcnew WebClient;
   Uri ^uri = gcnew Uri(address);
   String^ data = "Time = 12:00am temperature = 50";

   client->UploadStringCompleted += gcnew UploadStringCompletedEventHandler( UploadStringCallback2 );
   client->UploadStringAsync( uri, data );
}


public static void UploadStringInBackground2 (string address)
{
    WebClient client = new WebClient ();
    Uri uri = new Uri(address);
    string data = "Time = 12:00am temperature = 50";
    client.UploadStringCompleted += new UploadStringCompletedEventHandler (UploadStringCallback2);
    client.UploadStringAsync (uri, data);
}

Public Shared Sub UploadStringInBackground2(ByVal address As String)

	Dim client As WebClient = New WebClient()
	Dim data As String = "Time = 12:00am temperature = 50"
	AddHandler client.UploadStringCompleted, AddressOf UploadStringCallback2
                      Dim uri as Uri = New Uri(address)
	client.UploadStringAsync(uri, data)
End Sub

Die folgende Methode wird aufgerufen, wenn der Upload abgeschlossen ist.The following method is called when the upload completes.

void UploadStringCallback2( Object^ /*sender*/, UploadStringCompletedEventArgs^ e )
{
   String^ reply = dynamic_cast<String^>(e->Result);
   Console::WriteLine( reply );
}


private static void UploadStringCallback2 (Object sender, UploadStringCompletedEventArgs e)
{
        string reply = (string)e.Result;
        Console.WriteLine (reply);
}
Private Shared Sub UploadStringCallback2(ByVal sender As Object, ByVal e As UploadStringCompletedEventArgs)
    Dim reply As String = CStr(e.Result)
    Console.WriteLine(reply)
End Sub

Hinweise

Beim Erstellen eines UploadStringCompletedEventHandler-Delegaten bestimmen Sie die Methode für die Ereignisbehandlung.When you create a UploadStringCompletedEventHandler delegate, you identify the method that will handle the event. Um dem Ereignishandler das Ereignis zuzuordnen, fügen Sie dem Ereignis eine Instanz des Delegaten hinzu.To associate the event with your event handler, add an instance of the delegate to the event. Der Ereignishandler wird bei jedem Eintreten des Ereignisses aufgerufen, sofern der Delegat nicht entfernt wird.The event handler is called whenever the event occurs, unless you remove the delegate. Weitere Informationen zu den Ereignishandlerdelegaten, finden Sie unter behandeln und Auslösen von Ereignissen.For more information about event handler delegates, see Handling and Raising Events.

Extension Methods

GetMethodInfo(Delegate) GetMethodInfo(Delegate) GetMethodInfo(Delegate) GetMethodInfo(Delegate)

Ruft ein Objekt, das die durch den angegebenen Delegaten dargestellte Methode darstellt.Gets an object that represents the method represented by the specified delegate.

Gilt für: