【发布时间】:2016-06-15 15:24:59
【问题描述】:
我希望用户能够在复选框列表中动态添加一个项目,并且它将在 winform 关闭后保存。如果他稍后打开它,该项目仍然会在这里。
我是 C# 的新手,我过去常常在关闭后使用 Settings.settings 保存内容,但这样我只能保存新复选框列表的名称,而不是添加新复选框列表的操作。
private void additem_Click(object sender, EventArgs e)
{
Form2 form2 = new Form2();
form2.ShowDialog(); //a new form to add the name of the new checkboxlist
string newitem = form2.textBox1.Text; // take the string from the form2
checklistBox1.Items.Add(newitem)
}
我想在关闭后保存它,但我无法使用“设置”保存操作。有没有可能?
【问题讨论】: