tags:

views:

70

answers:

2

My current approach is to store date in .settings file and update it at the end of program, but it doesn't work.

code:

Settings.Default.RunTime = DateTime.Today;
Settings.Default.Save();

how to fix it?

A: 

whats the problem u got an exception or bad time will be saved? and where do u insert this code? u can save the last running time in registry or config files

SaeedAlg
+1  A: 

In Properties -> Settings, make sure the name of the setting is "RunTime", the type is "System.DateTime", and the scope is "user". After that, you should be able to use the following code:

// Access setting    
Properties.Settings.Default.RunTime= DateTime.Today;
// Save all settings
Properties.Settings.Default.Save();

If you would like more information on application settings, check out this MSDN article.

Ari Patrick