473,412 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

using app.config to store string variables

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
2 23571
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andy | last post by:
I haven't done any web work for over a year and for the life of me I cannot remember how to use a query string in a URL. I want the link to be page.aspx?ID=1 then pass 1 into a query like this ...
7
by: Tamir Khason | last post by:
Very strange problem I have windows service, that using information from inside App.config by ConfigurationSettings.AppSettings <- Everything is ok here BUT, once I want to read string such as...
3
by: Jim Lewis | last post by:
I have read several things that state accessing a Web Service through a Query String should work. However, when I try to execute http://localhost/webservice1/service1.asmx/HelloWorld I get the...
7
by: Thirsty Traveler | last post by:
I have a question regarding the use of guery string variables. I understand this can be a security risk subject to "brute force" attacks. Is this true and, if so, what is the proper way to handle...
2
by: Wally | last post by:
Dim var1 as String Dim var2 as String var1="message1" var2="message2" how do I join the two string variables?
6
by: johnny | last post by:
How do I join two string variables? I want to do: download_dir + filename. download_dir=r'c:/download/' filename =r'log.txt' I want to get something like this: c:/download/log.txt
1
by: Dinesh143 | last post by:
Where it is store the variables auto,static,extern,register,typedef,_declspec?
11
by: julie.siebel | last post by:
I'm working on a rather complex booking system for building European trips, in a combination of SQL/VBScript/Javascript. There are tons of query string variables that get passed back and forth...
1
by: Piotrekk | last post by:
Hi I have a strange problem. Here is some input data before I describe the problem. 1. RemoteClass (Mathematica) is compiled into dll and put to GAC 2. Server remoting configuration is done by...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.