PC Review


Reply
Thread Tools Rate Thread

Configuration appsettings

 
 
=?Utf-8?B?UmljaGFyZA==?=
Guest
Posts: n/a
 
      27th Feb 2004
Hi. I have a windows VB .NET application and the app.config file has an entry like this
<add key="key0" value="(###) ###-####" /
In my form load event handler, there is a line like
strDefaultPhoneFormat = ConfigurationSettings.AppSettings("key5"
But the debugger tells me strDefaultPhoneFormat contains Nothing after retrieving that settings value
If I copy the config file to the exe directory and run the program, the config file gets deleted every time the application starts, why? How can I prevent this

Any help with this will be appreciated
Thank

 
Reply With Quote
 
 
 
 
=?Utf-8?B?dE1hbg==?=
Guest
Posts: n/a
 
      27th Feb 2004
to retrieve a config key's value use
dim sKey as String = ConfigurationSettings.AppSettings("[keyname]").ToString(

when you build an executable, the app.config file will be created in the \bin folder and named as [YourAssemblyName].exe.config and the assembly will use this file

app.config should still be in the root folder of your project/solution



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.Configuration.ConfigurationManager.AppSettings Peter Kirk Microsoft C# .NET 2 10th Nov 2006 12:23 PM
"Unrecognized configuration section appsettings" exception thrown - Configuration.Appsettings(key) hazz Microsoft C# .NET 2 11th Jun 2004 10:54 PM
Re: Configuration AppSettings Atara Microsoft VB .NET 0 29th Feb 2004 10:30 AM
Re: Configuration AppSettings Jay B. Harlow [MVP - Outlook] Microsoft VB .NET 0 28th Feb 2004 04:20 AM
Re: Configuration AppSettings Scott Microsoft VB .NET 0 27th Feb 2004 04:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:36 AM.