Solved

vb.net and project resources

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

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 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

25 Experts available now in Live!

Get 1:1 Help Now