Solved

vb.net and project resources

Posted on 2014-11-24
4
236 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
That worked!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

9 Experts available now in Live!

Get 1:1 Help Now