Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

Update Application Settings

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Erick Sasse - 14 Feb 2006 01:47 GMT
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?

Signature

Erick Sasse

Otis Mukinfus - 14 Feb 2006 04:20 GMT
>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
Erick Sasse - 14 Feb 2006 10:54 GMT
> 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

Signature

Erick Sasse

Otis Mukinfus - 14 Feb 2006 11:46 GMT
>> Which Version of .NET are you using?
>
[quoted text clipped - 6 lines]
>'WindowsApplication1.Properties.Settings.Teste' cannot be assigned to
>-- it is read only
Hmm..  Sorry, but would you mind posting the code you are using to set
the value?

Thanks,

Otis Mukinfus
http://www.otismukinfus.com
http://www.tomchilders.com
Erick Sasse - 14 Feb 2006 12:48 GMT
> Hmm..  Sorry, but would you mind posting the code you are using to set
> the value?

No problem. :)

Properties.Settings.Default.Teste = textBox1.Text;

If you take a look at this article, the author talk about application
settings being read-only:

http://msdn.microsoft.com/msdnmag/issues/06/00/SmartClients/

Signature

Erick Sasse

Mike Edgewood - 14 Feb 2006 13:56 GMT
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.
Erick Sasse - 14 Feb 2006 14:07 GMT
> 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!

Signature

Erick Sasse

Mike Edgewood - 14 Feb 2006 14:52 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.