Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 805
  • Last Modified:

VB.net Open a pdf file in resources

Hi
I imported a pdf doc called test.pdf into my project resources and tried to open it using the following code
but I got the error shown in the image

Imports System.IO  
Imports System.Diagnostics  

        Dim pdf As Byte() = My.Resources.test

        Using tmp As New FileStream("test.pdf", FileMode.Create)

            tmp.Write(pdf, 0, pdf.Length)
        End Using

        Process.Start("test.pdf")

1
0
Murray Brown
Asked:
Murray Brown
2 Solutions
 
Rgonzo1971Commented:
Hi,

Maybe instead of FileMode.Create

FileMode.OpenOrCreate

or

FileMode.Open

Regards
0
 
LordWabbitCommented:
The line Process.Start("test.pdf") has opened the document in Acrobat, find all instances of Acrobat that are currently running and stop them.
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
thanks for the help
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now