Results 1 to 3 of 3

Thread: [RESOLVED] Files in resources

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2008
    Location
    South Africa
    Posts
    395

    Resolved [RESOLVED] Files in resources

    I want to know if it possible to do the following:

    1. Place a PDF file in the resources and open it in my program using 'AxAcroPDF1.src'

    2. Place a txt file in the resources, open and change it.

    If it is possible how?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Files in resources

    1. No.
    2. No.

    Resources are not files. They are data compiled into your EXE. One of the main reasons for resources is that they cannot be changed.

    An Adobe Reader control doesn't provide the ability for you to pass it binary data. All you can do is provide file path and it will load the file itself. If you embed a PDF file as a resource then you'd have to extract the data and save it as a file, then point the control to that file. You could always use the Temp folder, which exists specifically for this type of thing, then delete the file when you're finished.

    If you embed a text file as a resource then you'll get it back as a String. You can then do whatever you like with that String, e.g. save it as a file or display it. You can edit the String but that won;t affect the resource, so the next time you run the app the resource will be as it was. If you want to store an editable string then you could use My.Settings, but then it will be stored in a file anyway, so you may as well just use the original file. You should think about where you store it though, as some places make more sense than others.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2008
    Location
    South Africa
    Posts
    395

    Re: Files in resources

    thanks,

    that makes sence..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width