列表框选择的项目将显示在下拉列表中 [英] listbox selected item to be displayed in the dropdownlist
本文介绍了列表框选择的项目将显示在下拉列表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有列表框中的课程列表。
i有一个名为Add Course的按钮
然后我有一个下拉列表。
我在列表框中选择的课程,然后我点击添加课程,选择要添加到下拉列表中的课程。
我怎么能用csharp。
Rgds,
Narasiman P
i have list of course in the listbox.
i have one button called Add Course
Then i have one dropdownlist.
which course i select in the listbox, then i click the Add course, that selected course to be added in the dropdownlist.
for that how can i do using csharp.
Rgds,
Narasiman P
推荐答案
我很遗憾地说,但对我来说这只是基本不知道。
但是这里应该是你想要的。
I'm sorry to say but for me this is just to basic not to know.
But here this should be what you want.
private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Add(comboBox1.SelectedItem.ToString());
}
private void addcourse_Click(object sender, EventArgs e)
{
string text = listBox1.GetItemText(listBox1.SelectedItem);
dropdownid.Items.Add(text);
}
这篇关于列表框选择的项目将显示在下拉列表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文