none
Error in List saved in user settings: strings doesn't save RRS feed

  • Question

  • I have an List saved in my user settings, it should save several strings, but when I check its value (by Settings.Default.FileList.Count) it displays that the value is 0, when I save a string, it displays the number of strings saved, but when I Change of form or I restart the app, it's again 0.
    Wednesday, July 4, 2018 6:55 PM

All replies

  • Two things to check:

    - Verify that you didn't forget to call Settings.Default.Save()

    - Verify that the scope for the setting is "User". If it is "Application" it doesn't save.

    Thursday, July 5, 2018 6:30 AM
    Moderator
  • I have already done all of those things, but it still.
    Friday, July 6, 2018 4:08 PM
  • Hi SebGM2018,

    I create a FileList setting in settings of project properties. Here is the code which could save the value when you restart the application, I could get the value as what you want.

    I make two gif to show the results.

    First, I add the value of setting FileList3 without using Save() method. When you restart the application, the count does not save the value,

    And then when I use the Save() method, I could get the value after restart the application.

    Here is the code I used to test.

     Settings.Default.FileList3 = "hello";
                Settings.Default.Save();
                var count = Settings.Default.FileList3.Count();

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, July 10, 2018 9:33 AM
    Moderator