[英]c#: Populate combobox at design time
我已经知道如何使用c#代码填充组合框,但有没有办法在设计时使用设计器/属性填充组合框?
Go to the Properties explorer of combo box or Press F4 find the Items property. 转到组合框的属性资源管理器或按F4查找Items属性。 Refer to the image below.
请参考下图。
Hope it helps. 希望能帮助到你。
See Dans Answer : 见丹麦答案 :
var items = new BindingList<KeyValuePair<string, string>>();
items.Add(new KeyValuePair<string, string>("Mpost", "Posted"));
items.Add(new KeyValuePair<string, string>("Call", "Calling"));
items.Add(new KeyValuePair<string, string>("RScan", "Re-Scan"));
myComboBox.DataSource = items;
myComboBox.ValueMember = "Key";
myComboBox.DisplayMember = "Value";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.