Solved

vb.net and project resources

Posted on 2014-11-24
4
246 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…

828 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