I want to send crystal report as email

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Web.Mail

Public Class Form1
    Dim cryRpt As New ReportDocument
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Dim cryRpt As New ReportDocument
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        cryRpt.Load("K:\WindowsApplication3\cryRpt1.rpt")
        CrystalReportViewer1.ReportSource = cryRpt
        CrystalReportViewer1.Refresh()

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Try
            Dim CrExportOptions As ExportOptions
            Dim CrDiskFileDestinationOptions As New  _
            DiskFileDestinationOptions()
            Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions()
            CrDiskFileDestinationOptions.DiskFileName = _
                                        "k:\crystalExport.pdf"
            CrExportOptions = cryRpt.ExportOptions
            With CrExportOptions
                .ExportDestinationType = ExportDestinationType.DiskFile
                .ExportFormatType = ExportFormatType.PortableDocFormat
                .DestinationOptions = CrDiskFileDestinationOptions
                .FormatOptions = CrFormatTypeOptions
            End With
            cryRpt.Export()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try

        sendMail()

    End Sub

    Private Sub sendMail()
        Dim Msg As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage()
        Try
            Dim Smtp As SmtpMail
            SmtpMail.SmtpServer.Insert(0, "www.google.com")
            Dim Msg As MailMessage = New MailMessage
            Msg.To = "anne_shehara@yahoo.com"
            Msg.From = "anneshehara@gmail.com"
            Msg.Subject = "Crystal Report Attachment "
            Msg.Body = "Crystal Report Attachment "
            Msg.Attachments.Add(New MailAttachment("k:\crystalExport.pdf"))

            Smtp.Send(Msg)   
            MsgBox("the msg has been sent")
        Catch ex As Exception
            MsgBox(ex.ToString)

        End Try

    End Sub

button2 functionas are not working
i got the error like this:"The "SendUsing" configuration value is invalid."

Here is an article on MSDN that has code to do exactly what you are wanting.

Hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.