Adding multiple items to a combo box using AddRange
Baically I'm looking for something like this...
cbo_G开发者_如何学编程enre.Items.AddRange({"Horror", "Comedy"});
Have a look at this.
ComboBox1.Items.AddRange(new string[]{"Typical", "Compact", "Custom"});
cbo_Genre.Items.AddRange(new string[]{"Horror", "Comedy"});
AddRange
adds an array of items to the ComboBox.
You could try something like
cbo_Genre.Items.AddRange(new string[] {"Horror", "Comedy"});
This works in C# 4.0, using an implicitly typed array:
cbo_Genre.Items.AddRange(new[] {"Horror", "Comedy"});
精彩评论