如何将listview子项发送到组合框C# [英] How to send listview subitem to a combobox C#
问题描述
我一直在使用三个方面添加项目到listview:textbox(第1列),datetimepicker(第2列),combobox(第3列)。我一直在寻找的是当我单击编辑按钮时,第1列文本返回到文本框,第2列(选择的日期和
时间)返回到datetimepicker,第3列进入回到combobocx。我已成功完成了前两列回到文本框和datetimepicker,但我无法将第3列文本发送回
组合框。
I have been adding items to my listview using three things, textbox(column 1), datetimepicker(column 2), combobox(column 3). What I have been looking for is to when I click the edit button, column 1 text goes to back to the textbox, column 2 (the date and time that was selected) goes back to the datetimepicker, and column 3 goes back to the combobocx. I have successfully made it so that the first 2 columns go back to the textbox and datetimepicker, but I have not been able to send the column 3 text back to the combobox.
感谢您的帮助,
推荐答案
您好nlorenz,
Hi nlorenz,
>> 如何将listview子项发送到组合框C#
首先为两个组合框填充相同的值:
this.comboBox1.Items.Add("Cobe");
this.comboBox1.Items.Add("Durant");
this.comboBox1.Items.Add("James");
this.comboBox1.Items.Add("Curry");
this.comboBox2.Items.Add("Cobe");
this.comboBox2.Items.Add("Durant");
this.comboBox2.Items.Add("James");
this.comboBox2.Items.Add("Curry");
然后在编辑按钮点击事件:
Then in Edit button click event:
private void button1_Click(object sender, EventArgs e)
{
comboBox2.SelectedIndex = comboBox1.SelectedIndex;
}
希望这会有所帮助!
最好的问候,
Stanly
这篇关于如何将listview子项发送到组合框C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!