Preview: show a message when user clicks on exporting to email

Stimulsoft Reports.NET discussion
Post Reply
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Preview: show a message when user clicks on exporting to email

Post by Fabio Pagano »

In preview (not the designer one, the direct report preview) i need to show a messagebox if the user presses the "Send E-Mail" button. Then, after the message, the elaboration must continue with your default e-mail export dialog.

I have seen the ProcessSendEMail event (and the ClickSendEMailButton event that would be ok), i have handled it and i show my custom message in it, but after the message the elaboration stops so your default export window does not appear.

Is there a way to make appear a custom messagebox when user click "Send e-mail" and then the normal elaboration goes on?

This is the AddHandler:

Code: Select all

AddHandler mPreviewControl.ProcessSendEMail, New EventHandler(AddressOf Me.mPreviewControl_ProcessSendEMail)
This is the handler routine:

Code: Select all

Private Sub mPreviewControl_ProcessSendEMail(ByVal sender As Object, ByVal e As System.EventArgs)
        System.Windows.Forms.MessageBox.Show("This is my message")
End Sub
Thanks.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Preview: show a message when user clicks on exporting to email

Post by Edward »

Please use the following code to proceed your own actions while sending the report via email is in process.

C#

Code: Select all

stiPreviewControl1.ProcessSendEMail += new EventHandler(stiPreviewControl1_ProcessSendEMail);

public void stiPreviewControl1_ProcessSendEMail(object sender, EventArgs e)
{
    MessageBox.Show("ProcessSendEMail event is in process...");
    StiReport report = stiPreviewControl1.Report;
    if ((report != null) && report.IsRendered)
    {
        StiExportService service = sender as StiExportService;
        report.InvokeExporting(service.ExportFormat);
        service.Export(report, null, true);
        report.InvokeExported(service.ExportFormat);
    }
}	



VB.Net

Code: Select all

AddHandler Me.stiPreviewControl1.ProcessSendEMail, New EventHandler(AddressOf Me.stiPreviewControl1_ProcessSendEMail)

Private Sub stiPreviewControl1_ProcessSendEMail(ByVal sender As Object, ByVal e As EventArgs)
    MessageBox.Show("ProcessSendEMail event is in process...")
    Dim report As StiReport = Me.stiPreviewControl1.Report
    If ((Not report Is Nothing) AndAlso report.IsRendered) Then
        Dim service As StiExportService = TryCast(sender,StiExportService)
        report.InvokeExporting(service.ExportFormat)
        service.Export(report, Nothing, True)
        report.InvokeExported(service.ExportFormat)
    End If
End Sub
Thank you.


Post Reply