UploadStringCompletedEventArgs UploadStringCompletedEventArgs UploadStringCompletedEventArgs UploadStringCompletedEventArgs Class

Définition

Fournit des données pour l'événement UploadStringCompleted.Provides data for the UploadStringCompleted event.

public ref class UploadStringCompletedEventArgs : System::ComponentModel::AsyncCompletedEventArgs
public class UploadStringCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
type UploadStringCompletedEventArgs = class
    inherit AsyncCompletedEventArgs
Public Class UploadStringCompletedEventArgs
Inherits AsyncCompletedEventArgs
Héritage
UploadStringCompletedEventArgsUploadStringCompletedEventArgsUploadStringCompletedEventArgsUploadStringCompletedEventArgs

Exemples

L’exemple de code suivant illustre le transfert asynchrone d’une chaîne.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

La méthode suivante est appelée lorsque le chargement est terminé.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

Remarques

Instances de cette classe sont passées à la UploadStringCompletedEventHandler.Instances of this class are passed to the UploadStringCompletedEventHandler.

Propriétés

Cancelled Cancelled Cancelled Cancelled

Obtient une valeur qui indique si une opération asynchrone a été annulée.Gets a value indicating whether an asynchronous operation has been canceled.

(Inherited from AsyncCompletedEventArgs)
Error Error Error Error

Obtient une valeur qui indique quelle erreur s'est produite pendant une opération asynchrone.Gets a value indicating which error occurred during an asynchronous operation.

(Inherited from AsyncCompletedEventArgs)
Result Result Result Result

Obtient la réponse du serveur à une opération de transfert de chaînes qui est lancée par l'appel à une méthode UploadStringAsync.Gets the server reply to a string upload operation that is started by calling an UploadStringAsync method.

UserState UserState UserState UserState

Obtient l'identificateur unique de la tâche asynchrone.Gets the unique identifier for the asynchronous task.

(Inherited from AsyncCompletedEventArgs)

Méthodes

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Détermine si l'objet spécifié est identique à l'objet actuel.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Fait office de fonction de hachage par défaut.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Obtient le Type de l'instance actuelle.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crée une copie superficielle du Object actuel.Creates a shallow copy of the current Object.

(Inherited from Object)
RaiseExceptionIfNecessary() RaiseExceptionIfNecessary() RaiseExceptionIfNecessary() RaiseExceptionIfNecessary()

Lève une exception fournie par l'utilisateur en cas d'échec d'une opération asynchrone.Raises a user-supplied exception if an asynchronous operation failed.

(Inherited from AsyncCompletedEventArgs)
ToString() ToString() ToString() ToString()

Retourne une chaîne qui représente l'objet actuel.Returns a string that represents the current object.

(Inherited from Object)

S’applique à