开发者

Adding multiple items to a combo box using AddRange

开发者 https://www.devze.com 2023-03-06 00:41 出处:网络
Baically I\'m looking for something like this... cbo_G开发者_如何学编程enre.Items.AddRange({\"Horror\", \"Comedy\"});

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"});
0

精彩评论

暂无评论...
验证码 换一张
取 消