在combobox中如何使用csharp手动存储值 [英] in combobox how to store values manually using csharp
本文介绍了在combobox中如何使用csharp手动存储值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个组合框,因为我必须手动存储值。
当我在comboxbox中运行以下值时要显示
星期日
星期一
星期二
星期三
星期四
星期五
星期六
我怎么能把上面的东西存入使用c sharp的组合框。
请帮帮我。
我该怎么办,它是一个Windows应用程序。
I have one combo box, in that i have to store values manually.
when i run in the comboxbox below values as to be display
sunday
monday
tuesday
wednesday
thursday
friday
saturday
for that how can i store the above in combo box using c sharp.
please help me.
how can i do,it is a windows application.
推荐答案
ComboBoxID.Items.Add("sunday");
//and so on...
如何:从Windows窗体ComboBox,ListBox或CheckedListBox控件中添加和删除项 [ ^ ]
在开始编码之前完成基础知识!
How to: Add and Remove Items from a Windows Forms ComboBox, ListBox, or CheckedListBox Control[^]
Get your basics done before you start coding!
如果您的意思是,您想在组合框中添加一些值,请参阅以下内容:
http://msdn.microsoft.com/en-us/library/aa983551%28v=vs.71%29.aspx [ ^ ]
http://msdn.microsoft.com/pl-pl/library/19fc31ss%28v=vs.80%29 .aspx [ ^ ]
If you mean, you want to add some values in to combobox, see these:
http://msdn.microsoft.com/en-us/library/aa983551%28v=vs.71%29.aspx[^]
http://msdn.microsoft.com/pl-pl/library/19fc31ss%28v=vs.80%29.aspx[^]
我希望这会有效
I hope this will work
private void Form1_Load(object sender, EventArgs e)
{
if (Settings.Default.cboCollection != null)
this.comboBox1.Items.AddRange(Settings.Default.cboCollection.ToArray());
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
ArrayList arraylist = new ArrayList(this.comboBox1.Items);
Settings.Default.cboCollection = arraylist;
Settings.Default.Save();
}
//A button to add items to the ComboBox
private int i;
private void button1_Click(object sender, EventArgs e)
{
this.comboBox1.Items.Add(i++);
}
这篇关于在combobox中如何使用csharp手动存储值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文