Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help reading an application Config File
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00889292
Message ID:
00889325
Views:
25
Hi Kirk,

The appsettings section of the config file should be spelled "appSettings" with a lowercase "a". Give that a try.

>I have a simple winForm with a button and text box. I'm trying to figure out how to read a file setting from an application config file. The config file is named the same as the exe (didn't work at all before that), and I have the following code in my button:
>
>
>        Dim sOutput As String = " "
>        sOutput = ConfigurationSettings.AppSettings("ConnectionString")
>        Me.TextBox1.Text = sOutput
>
>In the debugger, sOutput is = to nothing
>
>My .config file has the following:
>
><?xml version="1.0" encoding="utf-8" ?>
><configuration>
>	<AppSettings>
>	<add key="ConnectionString" value "ConnectionStringText" />
>	</AppSettings>
></configuration>
>
>
>It runs without any errors, but I don't get the connection string text.
>
>Thanks for any help.
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform