1

My app.config has appSettings like that:

<appSettings>
    <add key="PdfSavePath" value="D:/Test" />
</appSettings>

Now i would like to change the PdfSavePath at runtime in my WPF application. When the user selects the path, it should also be updated in the app.config. I tried to do it like that (SavePath contains the new path):

ConfigurationManager.AppSettings["PdfSavePath"] = SavePath;

However, this didn't work. Does anybody have a solution for that?

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Gregor
  • 15
  • 1
  • 4
  • A better solution would be to use a `.settings` file instead. – Igor Apr 14 '18 at 18:56
  • Did you look at the [`ConfigurationManager` documentation](https://learn.microsoft.com/dotnet/api/system.configuration.configurationmanager)? The examples show how to add or modify an app setting. – Lance U. Matthews Apr 14 '18 at 19:02

0 Answers0