Results 1 to 12 of 12

Thread: [2005] [Resolved] Reading Config File For App???

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Smile [2005] [Resolved] Reading Config File For App???

    Hi All,

    I was just wondering what was the best method of reading info in from a file for an application. Basically I want to know the database path, reports path, location flag, etc. I was going to put it into an xml file and store the xml file in the same location as the app. Also is there anyway to get the path of the where the app is running in code?

    Thank you very much for any help,

    Jiggy!
    Last edited by Jigabyte; Jan 25th, 2007 at 06:40 AM.

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: [2005] Reading Config File For App???

    Another idea I came up with was to put in the install a script to write the entries into the registry and then in the app read that info but I dont have a clue where to start. Any help would be most appreciated!

    Cheers,

    Jiggy!

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: [2005] Reading Config File For App???

    Firstly, Application.StartupPath will return the folder that the application was run from.

    Secondly, you should probably use application settings to store the values you mention. You should first read up about My.Settings at MSDN and then post back with any questions you may have from there. It is advised to avoid using the registry in .NET apps if possible.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: [2005] Reading Config File For App???

    Thank you very much mate for the advice, I will look on MSDN and let you know how I get on.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: [2005] Reading Config File For App???

    Hi Mate,

    Can you tell me how I add my database and reports to my deploy project. I know how to change the install path for my application and want to put the database in a sub folder called data and my reports in a sub folder called reports.

    Thanks for any help,

    Jiggy!

  6. #6
    Member
    Join Date
    Jul 2006
    Posts
    40

    Re: [2005] Reading Config File For App???

    I am not sure how you are implementing your database install, but this is one suggestion. You can add the database files (.MDF and .LDF) to the project as embedded resource (from properties after addition).
    Entry level developer. Plenty to learn out there!
    Main Language: VB.NET
    Also familiar in: C#, Java, PHP.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: [2005] Reading Config File For App???

    What type of database are you using? If it's SQL Server are you attaching an MDF file that you created explicitly or are you creating a database on an existing server when you install? What type of installer are you using, e.g. Windows Installer Setup project, ClickOnce publishing, third-party installer?

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: [2005] Reading Config File For App???

    Hi Peeps,

    Thank you so much for all your advice. I am using an access database and crystal reports and using the visual studio installer setup project.

    Appologies for the delay, I did not receive and email stating a response.

    Cheers,

    Jiggy!

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: [2005] Reading Config File For App???

    You go to the File System page of your Setup project, add the folders under the Application Folder and add the files to the appropriate folders.

  10. #10

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: [2005] Reading Config File For App???

    Hi Mate,

    It's days like today that you should feel happy because you've just made my day, thanks mate.

    If I alter the database will it include the new one or will I need to re-add it. I am assuming now for the paths of these I can you application.startuppath\data etc?

    Thanks again mate,

    Jiggy!

  11. #11
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: [2005] Reading Config File For App???

    Every time you build your Setup project it will grab new files from whatever location you specify. You are correct about Application.StartupPath.

  12. #12

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: [2005] Reading Config File For App???

    Thanks again mate!

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