即使在关闭/重新启动程序后,如何永久保存变量中的值? [英] How can I save values in a variable permanently even after close/restart the program?

查看:110
本文介绍了即使在关闭/重新启动程序后,如何永久保存变量中的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望永久保存标签文本和文本框的最后一个值,以便关闭表单或程序并再次运行,它们的值等于最后一个值。

是可以不使用任何文件或数据库吗?我该怎么办?

I want to be saved last value of a label text and a textbox permannently such that with closing form or program and runnning again, the value of them equal to the last value is changed.
Is it possible without use of any file or DB?How can I do it?

推荐答案

好吧,鉴于这些限制,我会使用注册表...



使用C#从注册表中读取,写入和删除[ ^ ]



聪明的人会使用可以节省的界面等创建设置抽象注册表的条目,文件,数据库等[/ edit]
Well, given those constraints, I'd use the Registry ...

Read, write and delete from registry with C#[^]

[edit] a smart person would create a settings abstraction using interfaces etc that could save the entries to the registry, a file, a database etc [/edit]


是否可以不使用任何文件或数据库?



编号
"Is it possible without use of any file or DB?"

No.


这篇关于即使在关闭/重新启动程序后,如何永久保存变量中的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆