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 7458265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T13:25:31+00:00 2026-05-29T13:25:31+00:00

I’d like to use the .NET settings designer/framework to create application settings at design

  • 0

I’d like to use the .NET settings designer/framework to create application settings at design time and have these settings writeable by the application at runtime. It seems out of the box I can’t create settings that can be changed by the application and that are read by all users when they run the the application?

I have code that only allows one instance of the application across all users so conflict is not an issue.

So far I think I need to create a custom SettingsProvider. I’m hoping I can somehow inherit from LocalFileSettingsProvider and overwrite the file locations, but can’t find a way to do this.

  • 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-29T13:25:32+00:00Added an answer on May 29, 2026 at 1:25 pm

    This is how I did it. Now all I need to kn ow is if I need to implement IApplicationSettingsProvider in order to successfully migrate settings between versions? Peer reviews and comments welcome!

    using System.Collections.Generic;
    using System.Configuration;
    using System.Windows.Forms;
    using System.Collections.Specialized;
    using System.IO.IsolatedStorage;
    using System.IO;
    using System.Runtime.Serialization.Formatters.Binary;
    
    namespace NetworkManager
    {
        class IsolatedStorageSettingsProvider : SettingsProvider
        {
            public IsolatedStorageSettingsProvider()
            {
    
            }
    
            public override string ApplicationName
            {
                get { return Application.ProductName; }
                set { }
            }
    
            public override void Initialize(string name, NameValueCollection col)
            {
                base.Initialize(this.ApplicationName, col);
            }
    
            // SetPropertyValue is invoked when ApplicationSettingsBase.Save is called
            // ASB makes sure to pass each provider only the values marked for that provider -
            // though in this sample, since the entire settings class was marked with a SettingsProvider
            // attribute, all settings in that class map to this provider
            public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals)
            {
                // Iterate through the settings to be stored
                // Only IsDirty=true properties should be included in propvals
                foreach (SettingsPropertyValue propval in propvals)
                {
    
                    SetSettingValue(propval.Name, propval.SerializedValue);
                }
            }
    
            public override SettingsPropertyValueCollection GetPropertyValues(SettingsContext context, SettingsPropertyCollection props)
            {
    
                // Create new collection of values
                SettingsPropertyValueCollection values = new SettingsPropertyValueCollection();
    
                // Iterate through the settings to be retrieved
                foreach (SettingsProperty setting in props)
                {
                    SettingsPropertyValue value = new SettingsPropertyValue(setting);
                    value.IsDirty = false;
                    value.SerializedValue = GetSettingValue(setting);
                    values.Add(value);
                }
                return values;
            }
    
            private IsolatedStorageFile GetStore()
            {
                return IsolatedStorageFile.GetStore( IsolatedStorageScope.Machine | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain, null, null);
            }
    
            private object GetSettingValue(SettingsProperty setting)
            {
                BinaryFormatter formatter = new BinaryFormatter();
                var settings = new Dictionary<string, object>();
                var store = GetStore();
                using (var stream = store.OpenFile("settings.cfg", FileMode.OpenOrCreate, FileAccess.Read))
                {
                    if (stream.Length > 0) settings = (Dictionary<string, object>)formatter.Deserialize(stream);
                }
                return (settings.ContainsKey(setting.Name)) ? settings[setting.Name] : null;
            }
    
            private void SetSettingValue(string name, object value)
            {
                BinaryFormatter formatter = new BinaryFormatter();
                var settings = new Dictionary<string, object>();
                var store = GetStore();
                using (var stream = store.OpenFile("settings.cfg", FileMode.OpenOrCreate, FileAccess.Read))
                {
                    if (stream.Length > 0) settings = (Dictionary<string, object>)formatter.Deserialize(stream);
                }
                settings[name] = value;
                using (var stream = store.OpenFile("settings.cfg", FileMode.OpenOrCreate, FileAccess.Write))
                {
                    formatter.Serialize(stream, settings);
                }
                return ;
            }
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I would like to count the length of a string with PHP. The string

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.