-2

I am working on a project and I need a kind of variable that save the value and after restarting the program, the value won't get refresh.

For example: Home Page of a web browser that when you change it, it will save and after restarting the application, it won't reset to the first Home Page Address.

I thought that I can do it using application properties settings

Properties.Settings.Default.

But it didn't work.

Erfan
  • 437
  • 5
  • 9

1 Answers1

0

If the setting is application wide, and not per user, you can use the AppConfig to store the value. A similiar question was asked here.

Sample code copied from Amol M Kulkarni:

Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
    config.AppSettings.Settings.Add("YourKey", "YourValue");
    config.Save(ConfigurationSaveMode.Minimal);
Community
  • 1
  • 1
MeanGreen
  • 3,098
  • 5
  • 37
  • 63