开发者

How to save date of last application run-time?

开发者 https://www.devze.com 2023-01-17 21:51 出处:网络
My current approach is开发者_开发技巧 to store date in .settings file and update it at the end of program, but it doesn\'t work.

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号