+ 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

26th Apr 2018, 5:01 AM
SebGM2018
SebGM2018 - avatar
7 odpowiedzi
+ 1
I Need To create the User Settings at runtime. Not To change it
29th Apr 2018, 8:51 PM
SebGM2018
SebGM2018 - avatar
+ 1
That User Setting/User preference property that you said, like The properties.settings.default.Example
29th Apr 2018, 8:56 PM
SebGM2018
SebGM2018 - avatar
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.
29th Apr 2018, 8:45 PM
sneeze
sneeze - avatar
0
Can you give an example of a setting ?
29th Apr 2018, 8:53 PM
sneeze
sneeze - avatar
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 ?
29th Apr 2018, 9:03 PM
sneeze
sneeze - avatar
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.
29th Apr 2018, 10:18 PM
SebGM2018
SebGM2018 - avatar
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
30th Apr 2018, 8:23 PM
sneeze
sneeze - avatar