简体   繁体   English

文本框自动保存值/输入

[英]TextBox save value/input automatically

I would like to save a few values from text boxes that should be loaded into the text boxes every time I restart my program.我想从文本框中保存一些值,每次重新启动程序时都应将这些值加载到文本框中。

However, since my customers all use different values and should not re-enter them with every restart, I thought I could save these values somehow.然而,由于我的客户都使用不同的值并且不应该在每次重新启动时重新输入它们,我想我可以以某种方式保存这些值。 But I have no idea how to do that.但我不知道该怎么做。

my program is also tied to a database if there is a clean way, I would choose that too.如果有一种干净的方法,我的程序也与数据库相关联,我也会选择它。 my customers all have an account to log in to.我的客户都有一个帐户可以登录。 but it can also be a simple.txt or XML file, but how does that work?但它也可以是一个 simple.txt 或 XML 文件,但它是如何工作的呢?

I working with visual Studio C# WinForms.我使用 visual Studio C# WinForms。

Windows Forms comes with Settings , which allow you to save variable values and load them back up the next time your program is run. Windows Forms 带有Settings ,它允许您保存变量值并在下次运行程序时加载它们。 The Designer allows you to create settings and set the data types for them. Designer 允许您创建设置并为其设置数据类型。 See the Microsoft documentation in the link above for more information.有关详细信息,请参阅上面链接中的 Microsoft 文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM