开发者

Saving Selected Paths and Files on closing and open them on start WPF

开发者 https://www.devze.com 2023-03-16 04:35 出处:网络
Does someone know how to save text in textboxes and items in listviews so that the next time I start the application it will remember those specific settings.

Does someone know how to save text in textboxes and items in listviews so that the next time I start the application it will remember those specific settings. It wi开发者_StackOverflow社区ll need to save the settings on closure and open the settings on start.

All help is appriciated!

Thank you in advance!


This blog post has an excellent introduction to this area.

You need to create a Settings object. To this you add the properties you wish to persist and then on exit you call

Properties.Settings.Default.Save();

to write them to a user.config file. On start up you access them via something like this:

string username = Properties.Settings.Default[“Username”];

This MSDN article goes into even more depth.


there are number of options you can choose from:

  • you can you Configuration class to save your settings in your profile

  • create Business Object and persist/save it as xml and you can load it back on start up

0

精彩评论

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