Results 1 to 2 of 2

Thread: [RESOLVED] Changing app.config file

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    158

    Resolved [RESOLVED] Changing app.config file

    I have written a program and to make it more user friendly, I decided that instead of 'hiding' a value in the file <progname>.exe.config, I would put a fake value in said file and if the program sees the fake value, it will ask the user for the proper value. Once a proper value is entered, that would then be saved.

    Seems simple and everything worked just fine until the save part. My code is very simple:
    Code:
    My.Settings.ImageFolder = strImageFolder
    My.Settings.Save()
    When the program exits, the file D:\Users\<myuser>\AppData\Local\<myCompany>\<progName>.vshost.exe_Url_w0g22drgbdpf0co5rlclb1t5htehum f3\1.0.0.0 is written. However, when the program runs the next time, the 'If' statement that checks the setting, specifically
    Code:
    Dim strImageFolder As String = My.Settings.ImageFolder
    If strImageFolder = "foobar" Then
    is positive. Basically, the program (running in Debug) mode is reading the file either in C:\Users\<myuser>\Documents\Visual Studio 2012\Projects\<progName>\<progName> in the folder \bin\release below this directory and not the file that was just saved.

    Is there a way to get the Settings.Save command to write one of the files that is being read or to modify the program so that it reads the modified file? Thanks.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    158

    Re: Changing app.config file

    Sorry - coding error - works as expected.

Tags for this Thread

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