Adding multiple items to a combo box using AddRange
25,025
Solution 1
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.
Solution 2
You could try something like
cbo_Genre.Items.AddRange(new string[] {"Horror", "Comedy"});
Solution 3
This works in C# 4.0, using an implicitly typed array:
cbo_Genre.Items.AddRange(new[] {"Horror", "Comedy"});
Author by
John
Updated on May 13, 2020Comments
-
John about 4 years
Baically I'm looking for something like this...
cbo_Genre.Items.AddRange({"Horror", "Comedy"});