简体   繁体   English

使用AddRange将多个项目添加到组合框

[英]Adding multiple items to a combo box using AddRange

基本上我正在寻找这样的东西...

cbo_Genre.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. AddRange将一组项目添加到ComboBox。

您可以尝试类似

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

这在C#4.0中有效,使用隐式类型的数组:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM