Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Wrox's Visual Basic 2005 Express Edition Starter Kit ISBN: 978-0-7645-9573-8
This is the forum to discuss the Wrox book Wrox's Visual Basic 2005 Express Edition Starter Kit by Andrew Parsons; ISBN: 9780764595738
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Wrox's Visual Basic 2005 Express Edition Starter Kit ISBN: 978-0-7645-9573-8 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old January 30th, 2008, 06:19 AM
Registered User
Join Date: Jan 2008
Location: Pune, Maharashtra, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Mail Crystal Report from VB.Net 2005


  I have been trying to email a report in word or pdf format using MAPI service. Following is my code:

Dim mail As MicrosoftMailDestinationOptions = ExportOptions.CreateMicrosoftMailDestinationOption s
            Dim exOptions As ExportOptions = New ExportOptions

            mail.MailToList = Trim(utxtTo.Text)
            mail.MailCCList = Trim(utxtCC.Text)
            mail.MailSubject = Trim(utxtSubject.Text)
            mail.MailMessage = Trim(utxtMessage.Text)

            exOptions.ExportDestinationType = ExportDestinationType.MicrosoftMail
            exOptions.ExportDestinationOptions = mail
            If strType = "Word" Then
                exOptions.ExportFormatType = ExportFormatType.WordForWindows

            ElseIf strType = "PDF" Then
                exOptions.ExportFormatType = ExportFormatType.PortableDocFormat
            End If
            exOptions.ExportFormatOptions = New PdfRtfWordFormatOptions

the problem i am facing is that it is sending the mail in outlook's outbox with the email, subject and message all correct, but the word or pdf file is not attached with the mail. some Untitled.txt file is seen as attachment.

What could be reason? Plz give some solution for this.

(: SachinBhalerao :)
Reply With Quote
  #2 (permalink)  
Old April 14th, 2008, 12:09 PM
Registered User
Join Date: Apr 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

first thing you hav to do is to export the crystal report as PDF formt in specific location

            Dim CrExportOptions As ExportOptions
            Dim CrDiskFileDestinationOptions As New _
            Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions
            CrDiskFileDestinationOptions.DiskFileName = pdfFile
            CrExportOptions = cryRpt.ExportOptions
            With CrExportOptions
                .ExportDestinationType = ExportDestinationType.DiskFile
                .ExportFormatType = ExportFormatType.PortableDocFormat
                .DestinationOptions = CrDiskFileDestinationOptions
                .FormatOptions = CrFormatTypeOptions
            End With

after you export , email the pdf from the specific location

            Dim Smtp As SmtpMail
            SmtpMail.SmtpServer.Insert(0, "your hostname")
            Dim Msg As MailMessage = New MailMessage
            Msg.To = "to address here"
            Msg.From = "from address here"
            Msg.Subject = "Crystal Report Attachment "
            Msg.Body = "Crystal Report Attachment "
            Msg.Attachments.Add(New MailAttachment(pdfFile))

i found this code from a website , if yo need more information plz refer this link



Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Deploye crystal report with VB.NET 2005 zrtv Crystal Reports 2 June 6th, 2009 08:09 AM
VB 2005 Crystal Report Connection with SQL 2000 blackspear BOOK: Professional Crystal Reports for VS.NET 0 December 3rd, 2008 08:49 AM
simple report and crystal report in vb.net saket123 .NET Framework 2.0 0 August 13th, 2008 06:55 AM
Using Crystal in VB 2005 without Report Viewer csdunaway Crystal Reports 6 July 18th, 2007 11:48 AM
Problem in Crystal Report in VS.NET 2005 SaeedNawazMalik .NET Framework 2.0 1 March 4th, 2006 02:59 PM

All times are GMT -4. The time now is 03:28 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.