Error: Specified Cast is invalid

N

Nancy.

Hello:
Hope you can help me.
Below is the code in Windows Forms VB to Export
the "Notifications.rpt" Crystal reports to PDF. This
report is connected to a dataset.
The oRptNOTE.Export() line is failing. I am not sure
why.


Dim oRptNOTE As Notifications
oRptNOTE = New Notifications
oRptNOTE.SetDataSource(Dataset12.notification)
Dim DiskOpts As
CrystalDecisions.Shared.DiskFileDestinationOptions = New
CrystalDecisions.Shared.DiskFileDestinationOptions
oRptNOTE.ExportOptions.ExportDestinationType =
CrystalDecisions.[Shared].ExportDestinationType.DiskFile
oRptNOTE.ExportOptions.ExportFormatType =
CrystalDecisions.
[Shared].ExportFormatType.PortableDocFormat
DiskOpts.DiskFileName = "c:\temp\test2.pdf"
oRptNOTE.ExportOptions.DestinationOptions =
DiskOpts
oRptNOTE.Export()
 
N

Nancy.

I posted the subject issue last Friday. Instead I find
the following as an original message.
-----Original Message-----
Message unavailable

The issue I wrote is the following:
This is the code that converts a document to a pdf format.
Data is in a dataset format.
The error message is generated from this line:
oRptNOTE.Export()
If I display the information in the Crystalreports viewer
it works; however it does not if programmatically I want
to export to a pdf.
Thanks in advanced.
Nancy.

Dim oRptNOTE As Notifications
oRptNOTE = New Notifications
oRptNOTE.SetDataSource(Dataset12.notification)
Dim DiskOpts As
CrystalDecisions.Shared.DiskFileDestinationOptions = New
CrystalDecisions.Shared.DiskFileDestinationOptions
oRptNOTE.ExportOptions.ExportDestinationType =
CrystalDecisions.[Shared].ExportDestinationType.DiskFile
oRptNOTE.ExportOptions.ExportFormatType =
CrystalDecisions.
[Shared].ExportFormatType.PortableDocFormat
DiskOpts.DiskFileName = "c:\temp\test2.pdf"
oRptNOTE.ExportOptions.DestinationOptions =
DiskOpts
oRptNOTE.Export()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top