2011-05-12 113 views
2

Baically我正在尋找這樣的一個組合框...添加多個項目的AddRange使用

cbo_Genre.Items.AddRange({"Horror", "Comedy"}); 
+1

什麼是錯要麼cbo_Genre.Items =新名單(新的字符串[] {「恐怖」,「喜劇」});或cbo_Genre.Items =(新字符串[] {「恐怖」,「喜劇」}); – Cilvic 2011-05-12 20:03:02

回答

2

看一看這一點。

ComboBox1.Items.AddRange(new string[]{"Typical", "Compact", "Custom"}); 
cbo_Genre.Items.AddRange(new string[]{"Horror", "Comedy"}); 

AddRange將項目數組添加到組合框。

2

你可以嘗試像

cbo_Genre.Items.AddRange(new string[] {"Horror", "Comedy"}); 
1

這工作在C#4.0,使用隱式類型的數組:

cbo_Genre.Items.AddRange(new[] {"Horror", "Comedy"}); 
相關問題