473,387 Members | 3,781 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,387 software developers and data experts.

Configuration File

Hi

How do I manually read then values held in an app.config file.

I have an application with an application configuration file.
I can read the values in the file using Configuration.appsettings etc and
all is OK.

However I want to read the values from a DLL ( launched form another
application).
how do I do this?

Tim
Nov 20 '05 #1
5 1874
After all app.config is a XML file. You can always load it into DOM and work with it like a normal XML document.

Rgds,
Anand
VB.NET MVP
http://www.dotnetinda.com

"Tim Marsden" wrote:
Hi

How do I manually read then values held in an app.config file.

I have an application with an application configuration file.
I can read the values in the file using Configuration.appsettings etc and
all is OK.

However I want to read the values from a DLL ( launched form another
application).
how do I do this?

Tim

Nov 20 '05 #2
If you overload the constructor for the form in the DLL, you can pass it the
application object when you launch it, this way it will be able to reference
the app.config file of the calling code.

HTH - OHM ( Terry Burns )
"Tim Marsden" <TM@UK.COM> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
Hi

How do I manually read then values held in an app.config file.

I have an application with an application configuration file.
I can read the values in the file using Configuration.appsettings etc and
all is OK.

However I want to read the values from a DLL ( launched form another
application).
how do I do this?

Tim

Nov 20 '05 #3
Tim,
In the DLL you can use the same function:

Configuration.AppSettings

The trick is that only EXE's can have app.config files, you would need to
add an app.config to the other application (exe), with the relevent
settings.

Hope this helps
Jay

"Tim Marsden" <TM@UK.COM> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
Hi

How do I manually read then values held in an app.config file.

I have an application with an application configuration file.
I can read the values in the file using Configuration.appsettings etc and
all is OK.

However I want to read the values from a DLL ( launched form another
application).
how do I do this?

Tim

Nov 20 '05 #4
Do you have an example?
--
..NetHelpWanted
"Jay B. Harlow [MVP - Outlook]" wrote:
Tim,
In the DLL you can use the same function:

Configuration.AppSettings

The trick is that only EXE's can have app.config files, you would need to
add an app.config to the other application (exe), with the relevent
settings.

Hope this helps
Jay

"Tim Marsden" <TM@UK.COM> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
Hi

How do I manually read then values held in an app.config file.

I have an application with an application configuration file.
I can read the values in the file using Configuration.appsettings etc and
all is OK.

However I want to read the values from a DLL ( launched form another
application).
how do I do this?

Tim


Nov 20 '05 #5
This section of MSDN provides a couple of examples:

http://msdn.microsoft.com/library/de...ngssection.asp

As I stated, for a DLL, you simply add your settings to your exe's
app.config file. The DLL itself will find them. For a DLL however I would
recommend using a Custom Configuration Section instead of appSettings
itself, more to prevent conflicts then anything.

Hope this helps
Jay

".NetHelpWanted" <sa******@gmail.com> wrote in message
news:0E**********************************@microsof t.com...
Do you have an example?
--
.NetHelpWanted
"Jay B. Harlow [MVP - Outlook]" wrote:
Tim,
In the DLL you can use the same function:

Configuration.AppSettings

The trick is that only EXE's can have app.config files, you would need to add an app.config to the other application (exe), with the relevent
settings.

Hope this helps
Jay

"Tim Marsden" <TM@UK.COM> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
Hi

How do I manually read then values held in an app.config file.

I have an application with an application configuration file.
I can read the values in the file using Configuration.appsettings etc and all is OK.

However I want to read the values from a DLL ( launched form another
application).
how do I do this?

Tim


Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Alexander Kienzle | last post by:
I'm new to Java programming. I'm developing a Servlet for tomcat which needs an external configuration file. With external I mean a file (in XML format) which is customizable and not contained in...
2
by: kathy | last post by:
What Application Configuration File is? And when/where/how to use it? Any documents on that? MSDN has somrthings scatter everywhere - hard to follow. thanks,
4
by: Jessard | last post by:
Hi Guys and Girls, I have a situation where I am wishing to deploy a .NET dll onto a number of servers. The classes in the DLL will be used by VBScripts. When one of the classes - Connection -...
3
by: Florida Coder | last post by:
I have the need to store some application specific configuration data to be used by a class library and or a windows service. I would like to do this in a fashion similar to the way we do with...
0
by: phillip | last post by:
This is interesting, I have attached my web.config file and the exception I have been logging. I created a library which provide data access to a database and a control system. The library is...
1
by: Ramanfromoz | last post by:
Hi, Developing a new we application. Everything okay on my local WIN XP PROFESSIONAL, IIS 5.0 running locally. The website is running smoothly. Now, the same code I am copying over to a...
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
0
by: sean rogers | last post by:
hello im using the configuration block and have created the main config file for the application - the file that contains the paths to the other configuration sections i.e. - (my other...
6
by: Jeff Hegedus | last post by:
I have a dll that requires some configuration data. I put the configuration data in a custom configuration section in a config file that is loaded in the installation folder of the dll. If I...
3
by: Mike | last post by:
Hi I have problem as folow: Caught Exception: System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Request for the permission of type...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.