0

NOTE: The "possible duplicate" question refers to a totally and complete different theme (refering to visual studio user settings". This question is not related to that at all. Please verify before marking "possible duplicates"

I am trying to save some settings of my program between calls and I did what this tutorial says.

It works very well. A little too well...

To summarize I created settings.settings file. Then in the form closing file, I wrote code to save the settings

 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {    
       Properties.Settings.Default.TheSetting = settingNumber;
       Properties.Settings.Default.Save();
 }

and in the load function code to retrieve the setting

private void Form1_Load(object sender, EventArgs e)
{
    DateTime t = DateTime.Now;

    if (Properties.Settings.Default.TheDate.Date == t.Date)  //it is today
    {
        settingNumber = Properties.Settings.Default.TheSetting;
    }
    else
    {
        //we start again
        settingNumber = 0;                 
    }
    textBox1.Text = settingNumber.ToString();
}

I tried and run it several times, now the setting Number is 39.

However, and this is the strange thing this value is not found anywhere. I opened the .exe.config file that is supposed to hold the setting values and they have totally different numbers. Even if I edit them (as in the tutorial) the program still runs with its number.

Where are these setting values stored?

Community
  • 1
  • 1
KansaiRobot
  • 7,564
  • 11
  • 71
  • 150
  • Possible duplicate of [Where are the Visual Studio settings stored?](https://stackoverflow.com/questions/25031023/where-are-the-visual-studio-settings-stored) – TAHA SULTAN TEMURI Jul 02 '18 at 04:54
  • 1
    @TAHASULTANTEMURI I checked and it is a *complete different question* with only the general word "settings" being the same. – KansaiRobot Jul 02 '18 at 04:56
  • ok so you want the exact file where these settings are being saved? – TAHA SULTAN TEMURI Jul 02 '18 at 04:56
  • 1
    not talking about visual studio profile "settings" at all. I am interested in the settings file that a program uses for its execution. Let's go back to the real theme of the question. – KansaiRobot Jul 02 '18 at 04:59
  • 2
    As far as I know, it should be either Application folder or AppData folder. Did you check these folders to see any file (maybe by the name settings) is saved. – Swamy Jul 02 '18 at 05:07

1 Answers1

0

Thanks to user swamy I found the required file.

It was in AppData folder (which is in the corresponding User Folder) then Local, and under the a folder named after the program and the file name is user.config. The path is a really long one

I read that this path can change in other versions

KansaiRobot
  • 7,564
  • 11
  • 71
  • 150