+ 1
Create User Settings/User preferences at runtime (C#)
I Need to create new user settings in the app.config file in my c# app at runtime
7 odpowiedzi
+ 1
I Need To create the User Settings at runtime. Not To change it
+ 1
That User Setting/User preference property that you said, like The properties.settings.default.Example
0
Do you want to use the user-settings from the visual studio menu
menu project -> <project name> properties -> tab "settings" ?
You can reachted those values with
Properties.Settings.Default.<name of propertie>
https://www.codeproject.com/Articles/15013/Windows-Forms-User-Settings-in-C
https://www.dotnetperls.com/settings
Do you need to create the setting at runtime or do you just want to change the value of the setting at runtime.
0
Can you give an example of a setting ?
0
This is to little information.
A user setting is usually something you know when you are designing a form
Name
PassWord
etcc..
You can create those in
menu project -> <project name> properties -> tab "settings"
after you did create the settings in the this menu, you can use their value
UserNameTextBox.Text = Properties.Settings.Default.UserName
Properties.Settings.Default.UserName = UserNameTextBox.Text
ok PassWord is a bad example but that is another question
What do you want to do ?
0
I want To save a String, I know how To create the User Setting but I Need To create It at runtime, In Code.
0
use
Properties.Settings.Default.Save();
to save the usersetting.
In this link they make the user setting at runtime.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/c52b4fc6-66be-44ce-8a65-ab548f6f4f04/add-user-properties-settings-at-run-time?forum=csharpgeneral