Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 574373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:49:26+00:00 2026-05-13T13:49:26+00:00

I wrote this to quickly test Why arent my settings being saved? The first

  • 0

I wrote this to quickly test

Why arent my settings being saved? The first time i run this i have 3(old)/3(current) elements. The second time i get 3(old)/5(current), third time 5(old)/5(current).

When i close the app the settings completely disappear. Its 3 again when i run it. I made no changes to the app. Why arent my settings being saved

    private void button2_Click(object sender, EventArgs e)
    {
        MyApp.Properties.Settings.Default.Reload();
        var saveDataold = MyApp.Properties.Settings.Default.Context;
        var saveData = MyApp.Properties.Settings.Default.Context;
        saveData["user"] = textBox1.Text;
        saveData["pass"] = textBox2.Text;
        MyApp.Properties.Settings.Default.Save();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:49:26+00:00Added an answer on May 13, 2026 at 1:49 pm

    You should be using the exposed properties instead of putting your data in the context:

    var saveData = MyApp.Properties.Settings.Default;
    saveData.user = textBox1.Text;
    saveData.pass = textBox2.Text;
    

    The context

    provides contextual information that
    the provider can use when persisting
    settings

    and is in my understanding not used to store the actual setting values.

    Update: if you don’t want to use the Settings editor in Visual Studio to generate the strong-typed properties you can code it yourself. The code generated by VS have a structure like this:

        [UserScopedSetting]
        [DebuggerNonUserCode]
        [DefaultSettingValue("")]
        public string SettingName
        {
            get { return ((string)(this["SettingName"])); }
            set { this["SettingName"] = value; }
        }
    

    You can easily add more properties by editing the Settings.Designer.cs file.

    If you don’t want to use the strong-typed properties you can use the this[name] indexer directly. Then your example will look like this:

        var saveData = MyApp.Properties.Settings.Default;
        saveData["user"] = textBox1.Text;
        saveData["pass"] = textBox2.Text;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote this quickly under interview conditions, I wanted to post it to the
I quickly wrote this up, http://www.ionfish.org/php-shrink/ where a user uploads a .php file with
I need to quickly write a test console app for testing purposes. This app
I wrote this up quickly because I am having problems with it. I apologize
I wrote this code for zoom in/out . it works but even with one
I wrote this as a simple dice game. It works as I want except
I wrote this code for zoom in / out and it suppesed to only
I wrote this short program which has a tiny GUI. Its supposed to allow
I wrote this infeasible oml by mistake while trying to do another thing. What's
I wrote this program: #include <stdio.h> /*Part B Write a program that: defines an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.