Home All Groups Group Topic Archive Search About
Author
11 Apr 2005 3:33 PM
Carlos AZ
I have the following XML file named (applicattion.exe.config):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <AppSettings>
        <add key = "PathBD" value = "c:\project\data\maco.mdb" />
    </AppSettings>
</configuration>


Can anyone send me the code for reading   value of 'PathDB' please,


tanks

Author
11 Apr 2005 6:02 PM
Kevin Hodgson
Sure Carlos,

Import System.Configuration
directorypath = ConfigurationSettings.AppSettings("PathDB")

OR

directorypath =
System.Configuration.ConfigurationSettings.AppSettings("PathDB")

Hope that helps.
Kevin

Show quoteHide quote
"Carlos AZ" <Carlo***@discussions.microsoft.com> wrote in message
news:9632A615-6589-4B5F-8C48-D6E9B2912D1C@microsoft.com...
>I have the following XML file named (applicattion.exe.config):
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <AppSettings>
> <add key = "PathBD" value = "c:\project\data\maco.mdb" />
> </AppSettings>
> </configuration>
>
>
> Can anyone send me the code for reading   value of 'PathDB' please,
>
>
> tanks
Author
12 Apr 2005 10:12 AM
Kevin
You might like to try a DotNet DLL, which can read / write / modify /store
the Key-Value tags on-fly with many more features, on:
www.aspsimply.com/vbnet/protool.aspx



Show quoteHide quote
"Carlos AZ" <Carlo***@discussions.microsoft.com> wrote in message
news:9632A615-6589-4B5F-8C48-D6E9B2912D1C@microsoft.com...
>I have the following XML file named (applicattion.exe.config):
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <AppSettings>
> <add key = "PathBD" value = "c:\project\data\maco.mdb" />
> </AppSettings>
> </configuration>
>
>
> Can anyone send me the code for reading   value of 'PathDB' please,
>
>
> tanks
Author
12 Apr 2005 10:12 AM
Kevin
You might like to try a DotNet DLL, which can read / write / modify /store
the Key-Value tags on-fly with many more features, on:
www.aspsimply.com/vbnet/protool.aspx



Show quoteHide quote
"Carlos AZ" <Carlo***@discussions.microsoft.com> wrote in message
news:9632A615-6589-4B5F-8C48-D6E9B2912D1C@microsoft.com...
>I have the following XML file named (applicattion.exe.config):
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <AppSettings>
> <add key = "PathBD" value = "c:\project\data\maco.mdb" />
> </AppSettings>
> </configuration>
>
>
> Can anyone send me the code for reading   value of 'PathDB' please,
>
>
> tanks
Author
12 Apr 2005 10:12 AM
Kevin
You might like to try a DotNet DLL, which can read / write / modify /store
the Key-Value tags on-fly with many more features, on:
www.aspsimply.com/vbnet/protool.aspx



Show quoteHide quote
"Carlos AZ" <Carlo***@discussions.microsoft.com> wrote in message
news:9632A615-6589-4B5F-8C48-D6E9B2912D1C@microsoft.com...
>I have the following XML file named (applicattion.exe.config):
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <AppSettings>
> <add key = "PathBD" value = "c:\project\data\maco.mdb" />
> </AppSettings>
> </configuration>
>
>
> Can anyone send me the code for reading   value of 'PathDB' please,
>
>
> tanks
Author
12 Apr 2005 10:31 AM
Salvador
Hi,

Do you mean writing the App.Config file? This is considered bad practice, if
you need to modify the App.Config file within the application there is a
problem with the design.

Microsoft recommends to write using your own serialized object.

Hope this helps to understand .NET arch.
Salva


Show quoteHide quote
"Kevin" wrote:

> You might like to try a DotNet DLL, which can read / write / modify /store
> the Key-Value tags on-fly with many more features, on:
> www.aspsimply.com/vbnet/protool.aspx
>
>
>
> "Carlos AZ" <Carlo***@discussions.microsoft.com> wrote in message
> news:9632A615-6589-4B5F-8C48-D6E9B2912D1C@microsoft.com...
> >I have the following XML file named (applicattion.exe.config):
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <configuration>
> > <AppSettings>
> > <add key = "PathBD" value = "c:\project\data\maco.mdb" />
> > </AppSettings>
> > </configuration>
> >
> >
> > Can anyone send me the code for reading   value of 'PathDB' please,
> >
> >
> > tanks
>
>
>
Author
12 Apr 2005 10:31 AM
Salvador
Hi,

Do you mean writing the App.Config file? This is considered bad practice, if
you need to modify the App.Config file within the application there is a
problem with the design.

Microsoft recommends to write using your own serialized object.

Hope this helps to understand .NET arch.
Salva


Show quoteHide quote
"Kevin" wrote:

> You might like to try a DotNet DLL, which can read / write / modify /store
> the Key-Value tags on-fly with many more features, on:
> www.aspsimply.com/vbnet/protool.aspx
>
>
>
> "Carlos AZ" <Carlo***@discussions.microsoft.com> wrote in message
> news:9632A615-6589-4B5F-8C48-D6E9B2912D1C@microsoft.com...
> >I have the following XML file named (applicattion.exe.config):
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <configuration>
> > <AppSettings>
> > <add key = "PathBD" value = "c:\project\data\maco.mdb" />
> > </AppSettings>
> > </configuration>
> >
> >
> > Can anyone send me the code for reading   value of 'PathDB' please,
> >
> >
> > tanks
>
>
>
Author
12 Apr 2005 10:31 AM
Salvador
Hi,

Do you mean writing the App.Config file? This is considered bad practice, if
you need to modify the App.Config file within the application there is a
problem with the design.

Microsoft recommends to write using your own serialized object.

Hope this helps to understand .NET arch.
Salva


Show quoteHide quote
"Kevin" wrote:

> You might like to try a DotNet DLL, which can read / write / modify /store
> the Key-Value tags on-fly with many more features, on:
> www.aspsimply.com/vbnet/protool.aspx
>
>
>
> "Carlos AZ" <Carlo***@discussions.microsoft.com> wrote in message
> news:9632A615-6589-4B5F-8C48-D6E9B2912D1C@microsoft.com...
> >I have the following XML file named (applicattion.exe.config):
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <configuration>
> > <AppSettings>
> > <add key = "PathBD" value = "c:\project\data\maco.mdb" />
> > </AppSettings>
> > </configuration>
> >
> >
> > Can anyone send me the code for reading   value of 'PathDB' please,
> >
> >
> > tanks
>
>
>
Author
12 Apr 2005 2:08 PM
Chris Murphy via DotNetMonster.com
I'm not wanting to ignite a huge debate on this, but it seems to me that
NOT using [as in reading/writing/updating] the App.config file seems
counter-productive. If the INI file is considered deprecated, and practice
of using the Registry is frowned upon, they why not use the config file to
it's full potential? I'm writing a commercial application at the moment
that takes into considertation two things:

1. A user WANTS to customize a tool for their particular habits/needs
2. If the customized settings get wiped, then a default set of applications
will be needed.

To that end this is the solution that I'm following:
I've encapsulated methods for AppConfig and xml
serialization/deserialization of application settings into a couple
classes. ClassA is the Configuration manager, and ClassB is the xml
serializer/deserializer. All this is well and good, but in the event that
settings are wiped, the application simply replaces the config file with a
default copy that it stores as a resource (defaultsettings.xml) in the exe.

In my experience a simple solution like this is more than enough to deal
with business & IT requirements as well as cater to a user's needs.

--
Message posted via http://www.dotnetmonster.com