的WinForms / C#:2运行之间的文本框存储/检索(坚持)内容 [英] Winforms/C#: Store/Retrieve (Persist) Content of TextBoxes between 2 Runs

查看:119
本文介绍了的WinForms / C#:2运行之间的文本框存储/检索(坚持)内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法简单地告诉的WinForms(主要是文本框)坚持其所有内容的电子邮件的最简单方法。 G。不通过所有控件有循环我的文件?

Is there an easiest way to simply tell Winforms (mainly TextBoxes) to persist all its content e. g. to a file without me having to loop through all the controls?

我看到这个在WPF应用程序,但我无能(此外,谷歌没来任何东西)是否还有一个不折不扣的现成,最简单的方法。

I saw this in a WPF application, but am clueless (also, Google did not turn up anything) whether there is an out-of-the-box, easiest approach.

再次通过每个控制循环是可能的,但似乎..太辛苦了?

Again, looping through each control would be possible but seems.. too much work?

请问系列化也许工作?

推荐答案

您可以设置您的的applicationSettings PropertyBinding 在窗体设计,它分配一个字段名称然后当你关闭你的应用程序,你可以做到这一点,这将节省大家改变所有绑定的文本框的在应用程序的app.config文件。

You can set your ApplicationSettings PropertyBinding in the Form Designer, assign it a Field Name then when you close your application you can do this which will save all of you changes to all of the bound textbox's in the applications app.config file.

在这里输入的形象描述

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
    Properties.Settings.Default.Save(); 
}

这篇关于的WinForms / C#:2运行之间的文本框存储/检索(坚持)内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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