简体   繁体   English

C#Winform保存设置

[英]C# Winform save settings

I am working on a project in C# Winforms and one of the requirements is to allow the user to save various settings versions and give a name for each of them. 我正在使用C#Winforms开发一个项目,其中一项要求是允许用户保存各种设置版本并为每个设置名称命名。 The idea is to have a form, the user press the button Save Setting, enter a string in the text box for the name for that setting. 这个想法是要有一个表单,用户按下保存设置按钮,在文本框中输入一个字符串作为该设置的名称。 Later the user can select from a comboBox which settings to use. 以后,用户可以从comboBox中选择要使用的设置。 I already created a standard setting which saves automatically when the user closes the form. 我已经创建了一个标准设置,当用户关闭表单时该设置会自动保存。 Can you please direct me on how to that? 您能指导我如何做吗?

EDIT: The following forms demonstrate what I would like to achieve. 编辑:以下表格演示了我想要实现的目标。 The user enter some data in the textBoxes (form Main), then save the details giving to this setting the name of setting01 (form Save setting). 用户在文本框(窗体“主”)中输入一些数据,然后保存赋予此设置的详细信息,名称为“ seting01”(窗体“保存”设置)。 Then enter some other details and give the name of setting02. 然后输入其他一些详细信息,并命名为setting02。
在此处输入图片说明在此处输入图片说明在此处输入图片说明

Now the user can use setting01 or setting02, which contain different values for the same textBox. 现在,用户可以使用setting01或setting02,它们对于同一textBox包含不同的值。 在此处输入图片说明

Can please someone help me with this adventure? 可以请人帮我这个冒险吗?

Microsoft Developer Network has a nice tutorial on how to create a database and using it to store and retrieve data here Microsoft Developer Network上有一个很好的教程,介绍如何创建数据库以及如何使用它来存储和检索数据

Hope it helps. 希望能帮助到你。

EDIT: 编辑:

When the data is collected, do: 收集数据后,请执行以下操作:

combobox1.items.add(data_that_was_collected); combobox1.items.add(data_that_was_collected);

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

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