Update Application Settings

  • Thread starter Thread starter Erick Sasse
  • Start date Start date
E

Erick Sasse

When I create aplication settings using the settings editor, they are
read only. So how can I update them? :)

BTW, why they are read-only?
 
When I create aplication settings using the settings editor, they are
read only. So how can I update them? :)

BTW, why they are read-only?

Eric,

Which Version of .NET are you using?

In .NET 1.x MS thought it was a good idea not to provide a simple way
to update the Config files without using the DOM, but... not many of
us liked that.

In .NET 2.0 you should be able to read and write to the config file.

Can you post the error you are seeing?

Otis Mukinfus
http://www.otismukinfus.com
http://www.tomchilders.com
 
Otis said:
Which Version of .NET are you using?
2.0

In .NET 2.0 you should be able to read and write to the config file.
Can you post the error you are seeing?

Error 8 Property or indexer
'WindowsApplication1.Properties.Settings.Teste' cannot be assigned to
-- it is read only
 
Change setting type (aka Scope) from "Application" to "User" in the
settings editor for each object you need to have write access. With
Scope set to Application, those objects will be readonly.
 
Mike said:
Change setting type (aka Scope) from "Application" to "User" in the
settings editor for each object you need to have write access. With
Scope set to Application, those objects will be readonly.

Ok, but then if a user updates a setting it don't propagate to other
users, right?

I want to have app settings that a user can update. What's the best
approach?

Thanks!
 
Correct. It is stored locally. Just don't ask me where or what file.

Add a method for setting the value on demand (btnClick) or on exit
(formclosing)

If SaveMySettingsOnExit = True, you will not need to call
MySettings.Save as it will happen automatically on every form close.
You will, however, need to set the values.

To propagate user settigns on form close, set your variables that you
want to propagate to the next session in the formclosing event.
ie. MySettings.SettingStr1 = Me.TextBox1.Text
 
Back
Top