Solved

vb.net and project resources

Posted on 2014-11-24
4
241 Views
Last Modified: 2014-11-24
Hey guys, i have a project im working on which includes a non modifiable PDF document.  I am able to view it fine, but i want to embed the pdf in my exe and compile it at runtime.  I dont want to host it externally to the EXE.  Can i put it in the resources folder and then call it from there?  It doesnt seem to be working.  I have it in the resources and when i try to type in my.resources.filename.pdf, it cant find it at runtime.

Calling it like the below works:
 Private Sub BentleyManual_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        AxAcroPDF1.LoadFile("C:\Program Files (x86)\BMW Maintenance\Bentley_BMW_3_Series_2006-2010.pdf")
    End Sub

Open in new window


I want to call it via my.resources, but it fails to find it at runtime:
 Private Sub BentleyManual_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        AxAcroPDF1.LoadFile("Resources\Bentley_BMW_3_Series_2006-2010.pdf")
    End Sub

Open in new window


I added the file via the project settings resource tab. The pdf is set to None for Build Action and Do not copy for copy to output directory
0
Comment
Question by:derek7467
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:FarWest
ID: 40462499
you just simply add it to the project "add existing item" select build action as "resource"  in the item properties
0
 

Author Comment

by:derek7467
ID: 40462525
OK, i did that again, right click the project solution, add existing item, then i reference it like the below:
I set the build action to resource and the copy to output as do not copy.

Private Sub BentleyManual_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        AxAcroPDF1.LoadFile("Resources\Bentley_BMW_3_Series_2006-2010.pdf")
    End Sub

Open in new window


Just shows a grey adobe reader screen and DOES NOT display the actual pdf
0
 
LVL 12

Accepted Solution

by:
FarWest earned 500 total points
ID: 40462573
I think you have to use temp file to open it
check this thread

http://www.dreamincode.net/forums/topic/112777-use-pdf-file-from-myresources/
0
 

Author Closing Comment

by:derek7467
ID: 40462665
That worked!
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

786 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