G
Guest
Hello all
Can't seem to get 'System.Configuration.ConfigurationSettings.AppSettings' to work. What I've done thus far, is jus
create a windows app called 'WindowsApplication2'. To this app I used 'Add new Item' and added 'Application configuratio
file' and named it 'WindowsApplication2.exe.config'. I then rebuilt the solution. After rebuilding I went to the folder wher
my project is and copiled the .config file into the.bin\debug and tried run to cursor to see if I could read the .confi
file. Nope. Get an error
using System.Configuration
static void Main()
string test1 = System.Configuration.ConfigurationSettings.AppSetting
["Key1"].ToString()
MessageBox.Show(test1)
Application.Run(new Form1())
The .config looks like this
<?xml version="1.0" encoding="utf-8" ?><configuration><appSettings><add key="Key1" value="One" /><add key="Key2" value="Two" /><add key="Key3" value="Three" /></appSettings></configuration
When I run to "string test1.." and try to step over I get a
An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication2.ex
Additional information: Object reference not set to an instance of an object
Help, what am I missing, doing wrong,etc.
Any help appreciate
TIA
Ray K
Can't seem to get 'System.Configuration.ConfigurationSettings.AppSettings' to work. What I've done thus far, is jus
create a windows app called 'WindowsApplication2'. To this app I used 'Add new Item' and added 'Application configuratio
file' and named it 'WindowsApplication2.exe.config'. I then rebuilt the solution. After rebuilding I went to the folder wher
my project is and copiled the .config file into the.bin\debug and tried run to cursor to see if I could read the .confi
file. Nope. Get an error
using System.Configuration
static void Main()
string test1 = System.Configuration.ConfigurationSettings.AppSetting
["Key1"].ToString()
MessageBox.Show(test1)
Application.Run(new Form1())
The .config looks like this
<?xml version="1.0" encoding="utf-8" ?><configuration><appSettings><add key="Key1" value="One" /><add key="Key2" value="Two" /><add key="Key3" value="Three" /></appSettings></configuration
When I run to "string test1.." and try to step over I get a
An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication2.ex
Additional information: Object reference not set to an instance of an object
Help, what am I missing, doing wrong,etc.
Any help appreciate
TIA
Ray K