By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,882 Members | 928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,882 IT Pros & Developers. It's quick & easy.

using app.config to store string variables

P: n/a
hello

I was wondering if someone could point me in the direction of information on
using app.config to store string variables.

I have a couple of variables that store path information for file creation
and output, and i would like to store the paths in the app.config and have
them read into variables that are declared as strings. I have only been
able to use the app.config to store information that is associated with
dynamic properties on controls. I'm still a noob at this so any help would
be beneficial.

Thanks
john
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi John,

To store values in the app.config file, you will need to add the following
within the configuration section of the app.config file:

<appSettings>
<add key="SettingName" value="SettingValue" />
</appSettings>

To add more settings into the file, simply add another <add> entry into
<appSettings>.

To read the data back into your application, you would use something like
the following:

Dim VariableName as String =
System.Configuration.ConfigurationSettings.AppSett ings("SettingName")

Hope this is of some help

Kevin
"John Wildes" wrote:
hello

I was wondering if someone could point me in the direction of information on
using app.config to store string variables.

I have a couple of variables that store path information for file creation
and output, and i would like to store the paths in the app.config and have
them read into variables that are declared as strings. I have only been
able to use the app.config to store information that is associated with
dynamic properties on controls. I'm still a noob at this so any help would
be beneficial.

Thanks
john

Nov 21 '05 #2

P: n/a
You know I had a feeling you were going to say that. I hadn't tried it yet,
but its just like assigning that information to a control. Thanks for the
clarification Kevin.

john

"..:: Kevin ::.." <Ke***@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
Hi John,

To store values in the app.config file, you will need to add the following
within the configuration section of the app.config file:

<appSettings>
<add key="SettingName" value="SettingValue" />
</appSettings>

To add more settings into the file, simply add another <add> entry into
<appSettings>.

To read the data back into your application, you would use something like
the following:

Dim VariableName as String =
System.Configuration.ConfigurationSettings.AppSett ings("SettingName")

Hope this is of some help

Kevin
"John Wildes" wrote:
hello

I was wondering if someone could point me in the direction of information
on
using app.config to store string variables.

I have a couple of variables that store path information for file
creation
and output, and i would like to store the paths in the app.config and
have
them read into variables that are declared as strings. I have only been
able to use the app.config to store information that is associated with
dynamic properties on controls. I'm still a noob at this so any help
would
be beneficial.

Thanks
john

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.