Configuration settings - Howto? [modified]
-
I'm trying to find out how the config file works. This is how my config file looks like now.
foo The Sampletext is connected to a textbox and the default value shows. But how do I make if i want to write a new text and save it for the user, and next time I run the program the new value should show up in the textbox? I've tried with ConfigurationManager to store the new value, but I only get System.NullReferenceException so I do something wrong. -- modified at 13:11 Monday 15th October, 2007
-
I'm trying to find out how the config file works. This is how my config file looks like now.
foo The Sampletext is connected to a textbox and the default value shows. But how do I make if i want to write a new text and save it for the user, and next time I run the program the new value should show up in the textbox? I've tried with ConfigurationManager to store the new value, but I only get System.NullReferenceException so I do something wrong. -- modified at 13:11 Monday 15th October, 2007
-
I'm trying to find out how the config file works. This is how my config file looks like now.
foo The Sampletext is connected to a textbox and the default value shows. But how do I make if i want to write a new text and save it for the user, and next time I run the program the new value should show up in the textbox? I've tried with ConfigurationManager to store the new value, but I only get System.NullReferenceException so I do something wrong. -- modified at 13:11 Monday 15th October, 2007
Right click on your project and properties then goto settings. you can create a string there. It's a configuration property. These values are saved to your EXE' exe.config file. you can set to this string you created by doing a
your.projects.namespace.Properties.Settings.Default.YourSettingName = m_YourVariable;
Then to get the value of the settings you created you can do
m_YourVariable = your.projects.namespace.Properties.Settings.Default.YourSettingName;
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")