stuartw87
stuartw87

Reputation: 119

Windows application settings

I have a windows app written in C# (.net 3.5), and have a Settings.settings file that holds the application's settings.

When I do something like this:

Properties.Settings.Default.HSLastSend = DateTime.Now;
Properties.Settings.Default.Save();

it gets saved and persisted when I restart the application, however the Settings.settings file still has the original value. I can't seem to find where this new value is stored. I would have expected the Settings.settings file to have the new value when I went into it.

Is this a problem or normal?

Cheers in advance,

Stu

Upvotes: 1

Views: 797

Answers (2)

Tigran
Tigran

Reputation: 62246

Setting.settings provide default values for the application, instead changed one, is saved in your binary file resources. You can prove it by loading your application after save changed settings, and you will get you changed value, even if Settings file has still "old" one.

EDIT

Just note that Properties.Settings.Default.

On XP machine it should be at:

C:\Documents and Settings\"YourMachineUserName"\Application Data\

Regards.

Upvotes: 1

Chris McGrath
Chris McGrath

Reputation: 1757

This is normal the settings file stores static values only and is designed for storing runtime application settings in a centralized place dynamic values such as DateTime.Now cannot be stored in this manner if you want the current DateTime why not call it in your code

Upvotes: 0

Related Questions