using app.config to store string variables

  • Thread starter Thread starter John Wildes
  • Start date Start date
J

John Wildes

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
 
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.AppSettings("SettingName")

Hope this is of some help

Kevin
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top