|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
read app.configI 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 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 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 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 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 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 > > > 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 > > > 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 > > > 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.
Dragging a mail from Outlook/Outlook Express in to a .NET VB app
DataGrid Bind to DataSet, then Bind to DaTaview, GOT ERROR...PLS HELP File pointer to be positioned at the last occurance of a keyword How to back up an object... MDIChild form controls: how to pass information between them? Newbie VB Question Unexpected behaviour of MyClass (please ignore 1st post) Schedule task in VB.NET Can't set focus to controls on TabPage Why use Dim outside of sub? |
|||||||||||||||||||||||