我想保存我的ComboBox
项目,以便在关闭窗口应用程序后,我恢复之前保存的ComboBox
中的项目。我在类型的项目设置中声明组合框项目。我的代码如下。如何使用C#中的项目设置保存comboxitems
private void Form1_Load(object sender, EventArgs e)
{
comboBox1.Items.Add(Properties.Settings.Default.combox);
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
ArrayList arraylist = new ArrayList(this.comboBox1.Items);
Properties.Settings.Default.combox = arraylist;
}
但它显示错误:
Cannot implicitly convert type 'System.Collections.ArrayList' to 'System.Collections.Specialized.StringCollection'