Solved

VB.net Open a pdf file in resources

Posted on 2014-11-20
3
473 Views
Last Modified: 2014-11-23
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
Comment
Question by:murbro
3 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 250 total points
ID: 40454740
Hi,

Maybe instead of FileMode.Create

FileMode.OpenOrCreate

or

FileMode.Open

Regards
0
 
LVL 11

Assisted Solution

by:LordWabbit
LordWabbit earned 250 total points
ID: 40455032
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
 

Author Closing Comment

by:murbro
ID: 40461500
thanks for the help
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Clone Visual studio 2013 solution 5 25
update textboxes with Streamreader 21 42
Help with solving error related to resources file 4 36
Variable Event ? 3 23
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now