Skip to Content
0
Former Member
Jun 13, 2009 at 10:23 PM

2nd attempt pdf export: I.O. error - in use by another process.

86 Views

I am using vb.net 2008 with the bundled crystal reports.

I open a report in a CR viewer and have a button to export the rept to pdf and then email it. (using the DiskFileDestinationOptions() and rpt.exportoptions) All works fine. However, if user presses the button to do the email again (same rpt is still in viewer), I get the error:

system.IO.IO. exception. The process cannot access the file (myfile.pdf ) because it is being used by another process.

I found a post that said to close the report and the DiskFileDestinationOptions after the export but that does not solve the problem. I think it relates to the email with the pdf as an attachment.

The only way to solve this so far is to exit the viewer and create the report again.

What can I do to leave the viewer open and email more than once.