Save settings inside the executable?
Is it possible? If yes may someone help me?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Scott LysleRank #49 · 31K reputationPosted Feb 6, 2008, 7:36 PM EST
You can use the property settings to do this easily enough.
1. Open Properties from the solution explorer.
2. Click on the Settings Tab
3. Create a setting. Set the name, type, scope, and value. Scope should be set to user if you want to allow the user to do something that will be saved in the setting. The value can be any default value.
For example, if I want to load a greeting into a label control each time the user fires up the application, I can create a setting called Greeting, of type string, scope it to user, and set the default value to Hello.
To load the greeting, I would use something like this:
label1.Text = Properties.Settings.Default.Greeting;Now, if I add a textbox and a button to the form, I can give the user the means to change the setting.
If the user types into the textbox and clicks the button, I can change the greeting to whatever was typed into the textbox using something like this:
Properties.Settings.Default.Greeting = textBox1.Text; Properties.Settings.Default.Save();Sergio Fonseca54 reputationPosted Feb 7, 2008, 7:38 AM EST