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?

8 Years
Discussion Span
Last Post by Cory_Brown

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;

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%\ 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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.