I'm trying to save a string variable from my FolderBrowserDialog.SelectedPath().
Using a breakpoint I can see that the string is correctly loaded onto SelectedPath(), but I can't save that string to the .settings file for the life of me. Any help?
public void LocateWoWFolder()
{
using (FolderBrowserDialog FileDialogWindow = new FolderBrowserDialog())
{
if (FileDialogWindow.ShowDialog() == DialogResult.OK)
{
//Using a breakpoint here I can see that nothing is loaded to .WoWFolderLocation.
Properties.Settings.Default.WoWFolderLocation = FileDialogWindow.SelectedPath.ToString();
}
}
}
The setting WoWFolderLocation is string type, and is a User scope setting. What am I doing wrong? :P
You need to call Properties.Settings.Default.Save()
.
:)
来源:https://stackoverflow.com/questions/1283270/saving-a-string-to-a-setting-variable