Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading a value from Settings.settings

Status
Not open for further replies.

BlackburnKL

Programmer
Oct 21, 2002
196
0
0
US
I have a C# application that needs to call an external application. When I hard code the path to the external application, it works fine. However, I would like the path to the external application to come from a settings file instead.

I have stored the path as a string in a Settings.settings file. But, for all of the reading that I have done on the subject, I just can't seem to find code that will let me retrieve it from the file.

I know this has to be quite simple. Any help would be greatly appreciated.





BlackburnKL
 
It depends on what version of the framework you are using...

for 2.0 or greater..

Code:
string value = ConfigurationManager.AppSettings["key"];

for 1.0 or 1.1...

Code:
string value = ConfigurationSettings.AppSettings["key"];

Hope this helps

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top