I finally figured out how to use the settings.settings file to create user settings that would persist when reopening my application. I have several text boxes that once completed by the user I would like to retain their data when the app is reopened. This part now works, unfortunately a little too well.

I now have a problem of getting them to go away. I am trying to debug part of my application and I want my form starting in a fresh state each time, but now I can't seem to get these settings to stop. I've searched everywhere in my code and cant't figure out where it is still pulling them from.

I searched the sites that helped me get it working for a solution and I read that in the settings.settings editor you can click the synchronize option to clear them out but that does not help. Anyone have any thoughts as to where I should look?

If you have a setting called tb1 of type string, you should be able to clear and save it like this:

Properties.Settings.Default.tb1 = string.Empty;
Properties.Settings.Default.Save();

Thank you for the suggestion. I suppose I could put in some code that would let me clear it programatically as you have mentioned. I'm saving my settings in the forms close event so I would have to have a way to trigger it after that when I want to test with blank settings.

I beleive I have found the root of the problem though. When debugging my app it places a copy of the user.config file in the C:\Users\%user%\AppData\Local\%company_name%\%app_name_with_extras%\1.0.0.0 directory (man that was burried). For some reason my debugging in the IDE was picking up this file. I deleted it and was able to start with a fresh form. I just have to remember to delete that file each time I want to test starting from scratch.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.