The following program describes how to email a Crystal Reports from C# .
All C# Crystal Reports Tutorial in this website is based on the following database - crystaldb. So before you begin this section , please take a look at the database structure of crystaldb - Click Here C# crystaldb
If you are new to Crystal Reports and do not know how to create Crystal Reports from C# , please take a look at the section step by step tutorial for creating a Crystal Reports from C#.
For email a Crystal Report from C# first we have to export the Crystal Reports in any of the File Format available in Crystal Reports and then Email it.
In this section we use the previous tutorial C# Crystal Reports Export to PDF file . So before we start this section please take a look at the tutorial C# Crystal Reports Export to PDF file.
After export the Crystal Reports as a PDF file format in your disk , the next step is to email that .pdf file . For that here we are using System.Web.Mail of C# . We have to provide the necessary information to configuring SmtpMail client and send the exported file as attachment .
Select the default form (Form1.cs) you created in C# and drag two buttons (Button1, Button2 ) and a CrystalReportViewer control to your form.
You have to include CrystalDecisions.CrystalReports.Engine in your C# Source Code.
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.Web.Mail