App.config file

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

It's easy enough to read from a VB.net configuration file...

variable = ConfigurationSettings.AppSettings("key")

However, how do you write to one ?

Thanks !
 
Rob said:
It's easy enough to read from a VB.net configuration file...

variable = ConfigurationSettings.AppSettings("key")

However, how do you write to one ?

Thanks !

Don't don't have access from inside a vb.net class to write to an
app.config file. If you want to save user settings and such use a
different file.

Chris
 
Note that if you are using VS2005, you can take advantage of the My.Settings feature to read and write such properties, such as (after adding "Foo" in the Settings designer):

My.Settings.Foo = Me.SomeValue ' write
Me.SomeValue = My.Settings.Foo 'read

Such settings are persisted per-user in the appropriate "Documents and Settings" application data folder.

--Matt Gertz--*
VB Compiler Dev Lead

-----Original Message-----
From: Chris
Posted At: Monday, November 14, 2005 1:25 PM
Posted To: microsoft.public.dotnet.languages.vb
Conversation: App.config file
Subject: Re: App.config file

It's easy enough to read from a VB.net configuration file...

variable = ConfigurationSettings.AppSettings("key")

However, how do you write to one ?

Thanks !

Don't don't have access from inside a vb.net class to write to an
app.config file. If you want to save user settings and such use a
different file.

Chris
 
Note that if you are using VS2005, you can take advantage of the My.Settings feature to read and write such properties, such as (after adding "Foo" in the Settings designer):

My.Settings.Foo = Me.SomeValue ' write
Me.SomeValue = My.Settings.Foo 'read

Such settings are persisted per-user in the appropriate "Documents and Settings" application data folder.

--Matt Gertz--*
VB Compiler Dev Lead

-----Original Message-----
From: Chris
Posted At: Monday, November 14, 2005 1:25 PM
Posted To: microsoft.public.dotnet.languages.vb
Conversation: App.config file
Subject: Re: App.config file




Don't don't have access from inside a vb.net class to write to an
app.config file. If you want to save user settings and such use a
different file.

Chris

oooo, interesting... I did not know this...

Thank.
Chris
 
It's probally important to note that an Application scoped setting is
read-only. Where as a User scoped setting is capable of being written to.
 
Back
Top