2013-02-01 131 views
1

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

+0

是的。什麼樣的組合框? WPF,WinForms,ASP.NET? – Markus

+0

如果是Forms.COmboBox,則在Properties選項卡中有Items集合 – Arie

+0

使用WinForms。 – Kairan

回答

2

轉到組合框或按F4的屬性探險家發現的物品屬性。參考下面的圖片。 combobox properties

希望它有幫助。

1

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";