dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: How to find application data files?

  1. #1
    Join Date
    Dec 2010
    Posts
    4

    Question How to find application data files?

    I'm trying to find a good strategy to access data files, image files, etc., that I want to distribute in my VB.NET deployment. The challenge I'm having is to find a place to put the files, and a means for the program to find them, regardless of whether the program is running in the Visual Studio environment as a debug build or release build, or running as an installed application.

    I've considered using AppDomain.CurrentDomain.BaseDirectory to find the location of the EXE file, then using relative paths to that folder. However, that approach depends on the directory hierarchy imposed by the Visual Studio tools when it separates the binaries of debug and release builds. Both builds would have to navigate upward to reach a common root folder, and the path traversal algorithm must work for the deployed EXE file too.

    Can anyone recommend a general approach to solve this problem? Ideally, I would like to have a content folder directly underneath the folder that holds the deployed EXE file. I'm new to VB.NET and just now trying to figure out how to make deployment packages, so I also need to learn how to get my content folder included in the deployment package.

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to find application data files?

    Put them on a website, or network share
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Dec 2010
    Posts
    4

    Re: How to find application data files?

    I'd like to clarify that the data files I'm looking to include are like resources (images, icons, etcs). They are required for the program to operate correctly. They need to belong in the distribution itself so that they don't have to rely on gaining access to the web or other external storage after installation.

  4. #4
    Join Date
    Dec 2009
    Posts
    596

    Re: How to find application data files?

    The way I handle that is I put the database and images in the ProgramData folder. In the formload event if the database and files do not exist I copy them from the app.path. This will need some tweaking with XP since XP does not have ProgramData. I haven't done the tweak myself yet. The tweak would create ProgramData if it didn't exist. Dglienna turned me on to using ProgramData in the past for database placement by the way. Anyway this has worked well for me.

  5. #5
    Join Date
    Nov 2010
    Posts
    54

    Re: How to find application data files?

    Maybe a C#/VB.NET component will be helpful...

  6. #6
    Join Date
    Dec 2009
    Posts
    596

    Re: How to find application data files?

    @e-iceblue. How is your suggestion supposed to help the OP with this problem? Can you explain it to us? I'm giving you the benifit of the doubt that you aren't just simply advertising.

  7. #7
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to find application data files?

    He is. 5 of 5 posts.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)