Properties.Settings.Default.Default.Save() does not work

Posted by Akshay on Stack Overflow See other posts from Stack Overflow or by Akshay
Published on 2010-12-25T13:22:10Z Indexed on 2010/12/25 14:54 UTC
Read the original article Hit count: 217

Filed under:
|

I have created code in WPF to let the window remember its last location like this:

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    try
    {
        Rect storedLoc = Properties.Settings.Default.WindowSavedLocation;
        this.Top = storedLoc.Top;
        this.Left = storedLoc.Left;
    }
    catch
    {
        MessageBox.Show("No settings stored !");
    }
}

private void Window_Closed(object sender, EventArgs e)
{
   Properties.Settings.Default.WindowSavedLocation = RestoreBounds;
   Properties.Settings.Default.Save();
}

When I build the application I can see that the app.exe.config file has the setting

WindowSavedLocation

but it just does not save and throws no exception.

Everytime I run the application, it says "No settings stored !".

It's scope is user.

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf