I think the problem is your pdf attachment file. You are going to need somewhere safe to create it. You'll create the attachment file path and name using this code:
Dim pdfFile As String = System.IO.Path.GetTempPath & "File.pdf"
If System.IO.File.Exists(pdfFile) Then My.Computer.FileSystem.DeleteFile(pdfFile)
Then you'll export the cryRpt object to a pdf file using just one line of code:
cryRpt.ExportToDisk(ExportFormatType.PortableDocFormat, pdfFile)
If no exception occurs your attachment is created and ready to be mailed.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…