Adding multiple items to a combo box using AddRange
-
12-11-2019 - |
문제
Baically I'm looking for something like this...
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.
다른 팁
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"});
제휴하지 않습니다 StackOverflow