views:

55

answers:

2

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

+3  A: 

You need to call Properties.Settings.Default.Save().

:)

womp
Thank you, worked perfectly.
Sergio Tapia
A: 

You must call ...

Properties.Settings.Default.Save();

Check out Using Settings in C#.

JP Alioto