title: Adding a user Settings property at runtime (Winforms)
body: <p>I am using C# ,win forms and .net 2.0 </p>
  
  <p>I am trying to add a property inside user settings file at run time but i am not able to view that added property in settings.settings file in certain location i.e. file exists but property is not added</p>
  
  <p>I am not getting error when i call this property it works 
  Using this below code </p>
  
  <pre><code>MessageBox.Show(***********.Properties.Settings.Default.Properties["NewProperty"].DefaultValue);
  </code></pre>
  
  <p>I have written this following code 
  Calling the function</p>
  
  <pre><code>clCommonFuncation cl = new clCommonFuncation();
          if (***********.Properties.Settings.Default.Properties["NewProperty"] == null)
          {
              cl.addPropertyinSettingsFile("NewProperty",
              ***********.Properties.Settings.Default.Providers,
              ***********.Properties.Settings.Default.Providers["LocalFileSettingsProvider"],
              ***********.Properties.Settings.Default.Properties,
              typeof(string),"ASD",null);
              ***********.Properties.Settings.Default.Save();
              ***********.Properties.Settings.Default.Reload();
          }
  </code></pre>
  
  <p>And this is calling funaction</p>
  
  <pre><code> public void addPropertyinSettingsFile(string settingName,
          SettingsProviderCollection settingsProviderCollection,
          SettingsProvider settingsProvider,
          SettingsPropertyCollection settingPrpertyCollection,
          Type dataType,
          object defaultValue,
          object settingDefault)
      {
          SettingsProperty lvSettingProperty = new SettingsProperty(settingName);
          lvSettingProperty.DefaultValue = defaultValue;
          lvSettingProperty.IsReadOnly = false;
          lvSettingProperty.PropertyType = dataType;
          lvSettingProperty.Provider = settingsProvider;
          lvSettingProperty.SerializeAs = SettingsSerializeAs.String;
          lvSettingProperty.Name = settingName;
          lvSettingProperty.Attributes.Add(typeof(System.Configuration.UserScopedSettingAttribute),
              new System.Configuration.UserScopedSettingAttribute());
          settingPrpertyCollection.Add(lvSettingProperty);            
      }
  </code></pre>
  
  <p>What is it i am doing wrong?
  Any suggestion will be appreciated
  Thank you</p>