PowerTCP Mail for .NET
Progress Event
See Also  Example Send comments on this topic.
Dart.PowerTCP.Mail Namespace > Smtp Class : Progress Event




Raised repeatedly while an email message is sent.

Syntax

Visual Basic (Declaration) 
<CategoryAttribute("Progress")>
<DescriptionAttribute("Raised repeatedly while a file transfer is in progress.")>
Public Event Progress As SmtpProgressEventHandler
Visual Basic (Usage)Copy Code
Dim instance As Smtp
Dim handler As SmtpProgressEventHandler
 
AddHandler instance.Progress, handler
C# 
[CategoryAttribute("Progress")]
[DescriptionAttribute("Raised repeatedly while a file transfer is in progress.")]
public event SmtpProgressEventHandler Progress
Managed Extensions for C++ 
[CategoryAttribute("Progress")]
[DescriptionAttribute("Raised repeatedly while a file transfer is in progress.")]
public: __event SmtpProgressEventHandler* Progress
C++/CLI 
[CategoryAttribute("Progress")]
[DescriptionAttribute("Raised repeatedly while a file transfer is in progress.")]
public:
event SmtpProgressEventHandler^ Progress

Event Data

The event handler receives an argument of type ProgressEventArgs containing data related to this event. The following ProgressEventArgs properties provide information specific to this event.

PropertyDescription
Length The length of the stream.
Position The position within the stream.

Example

The following example demonstrates using the Progress event to display information about the send operation.
Visual BasicCopy Code
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Mail"
' at the top of your class.

Private Sub ProgressTest()
   ' Do something to cause the Progress event to be raised
   Smtp1.Server = "mail.test.com"
   Smtp1.Send("you@test.com", "me@test.com", "test", "test message")
End Sub

Private Sub Smtp1_Progress(ByVal sender As Object, ByVal e As Dart.PowerTCP.Mail.ProgressEventArgs) Handles Smtp1.Progress
   ' Set the ProgressBar with progress info.
   ProgressBar1.Minimum = 0
   ProgressBar1.Minimum = e.Length
   ProgressBar1.Value = e.Position
End Sub
C#Copy Code
// Be sure to import the namespace by putting "using Dart.PowerTCP.Mail;"
// at the top of your class.

private void ProgressTest()
{
   // Do something to cause the Progress event to be raised
   smtp1.Server = "mail.test.com";
   smtp1.Send("you@test.com", "me@test.com", "test", "test message");
}

private void smtp1_Progress(object sender, Dart.PowerTCP.Mail.ProgressEventArgs e)
{
   // Set the ProgressBar with progress info.
   progressBar1.Minimum = 0;
   progressBar1.Maximum = (int)e.Length;
   progressBar1.Value = (int)e.Position;
}

Remarks

This event is raised repeatedly while an email message is sent. A ProgressEventArgs object will be passed into the event, containing data about the progress (such as bytes transferred, total bytes, etc). For more information on using events using PowerTCP.NET within the Visual Studio.NET environment, see Using Events Within The Visual Studio.NET Environment.

The Smtp.Connection.SendBufferSize property controls how often this event will be raised.

If you are using the Smtp component as a reference, you must create a method to handle the event yourself. To learn how to do this, see Using Events When A Component Is Used As A Reference.

This event is useful for displaying progress information (perhaps in a ProgressBar object) to the user.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.