簡體   English   中英

c#:在設計時填充組合框

[英]c#: Populate combobox at design time

我已經知道如何使用c#代碼填充組合框,但有沒有辦法在設計時使用設計器/屬性填充組合框?

轉到組合框的屬性資源管理器或按F4查找Items屬性。 請參考下圖。 組合框屬性

希望能幫助到你。

丹麥答案

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM