[英]how to do: what i pick on combobox1 will show on combobox2?
how to do: what i pick on combobox1 will show on combobox2 ? 怎么做:我在combobox1上选择的内容将显示在combobox2上?
is it possible ? 可能吗 ? (in C#)
(在C#中)
thank's in advance 提前致谢
You need to subscride second combobox on the SelectedIndexChanged event of the first combobox and change value when event triggers. 您需要在第一个组合框的SelectedIndexChanged事件上替代第二个组合框,并在事件触发时更改其值。 Also you need to make sure that both combobox have several items or you will need to add missing items to second combobox dynamically.
另外,您还需要确保两个组合框都包含多个项目,否则您将需要动态地将缺少的项目添加到第二个组合框中。
Event handler example: 事件处理程序示例:
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
object selectedValue = this.comboBox1.SelectedValue;
this.comboBox2.SelectedValue = selectedValue;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.