|
-
Nov 9th, 2005, 08:30 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Reading app.config
HI all using the following code.
Code:
//Should just bring back my name from a config file
try
{
string x =ConfigurationSettings.AppSettings["name"].ToString();
MessageBox.Show(x.ToString());
}
catch(ConfigurationException ce)
{
MessageBox.Show(ce.Message);
}
catch(Exception ge)
{
MessageBox.Show(ge.Message);
}
Works fine in the IDE but when i run the release version I get the following exception message.
Object reference not set to an instance of an object
ANy help would be greatly appreciated!!
Last edited by Bombdrop; Nov 9th, 2005 at 09:13 AM.
Useful Links
.Net
#Develop, GhostDoc, CodeKeep , be.PINVOKE, Good Code Snippet Site
Krypton Toolkit, XPCC / XP Common Controls, QSS Windows Forms Components
VB.COM
VB.Classic Help File, MB Controls, MZTools, ADO Stored Procedure Generator add-in,
-
Nov 9th, 2005, 08:36 AM
#2
Re: Reading app.config
What happens when you change the key 'name' to something else, like 'myname'?
-
Nov 9th, 2005, 08:43 AM
#3
Thread Starter
Fanatic Member
Re: Reading app.config
Still the same, my config file looks like so.
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.windows.forms jitDebugging="true" />
<appSettings>
<add key="name" value="BombDrop"/>
</appSettings>
</configuration>
the thing thatg really gets me is that it works in the ide but not from the release exe?
Useful Links
.Net
#Develop, GhostDoc, CodeKeep , be.PINVOKE, Good Code Snippet Site
Krypton Toolkit, XPCC / XP Common Controls, QSS Windows Forms Components
VB.COM
VB.Classic Help File, MB Controls, MZTools, ADO Stored Procedure Generator add-in,
-
Nov 9th, 2005, 09:13 AM
#4
Thread Starter
Fanatic Member
Re: Reading app.config
Sorry abousolute stupid idiot I was running the exe from the object file insted of the bin folder\release
sorry guys
Useful Links
.Net
#Develop, GhostDoc, CodeKeep , be.PINVOKE, Good Code Snippet Site
Krypton Toolkit, XPCC / XP Common Controls, QSS Windows Forms Components
VB.COM
VB.Classic Help File, MB Controls, MZTools, ADO Stored Procedure Generator add-in,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|