C# - is it possible to arrange ComboBox Items from a to z?
There are two possible ways that I could think of:
A) Use the WinForms Combobox Sorted
Property
If you're using WinForms, you can use ComboBox.Sorted = true;
B) Manually Sort your List with OrderBy
If the data in your combo box comes from in a form of a list, use OrderBy to the List
of data you are going to put in the ComboBox
before setting it.
Here's an example:
var myList = new List<string>() {"q","w","e","r","t","y"};
var sorted = a.OrderBy(c => c).ToArray()
comboBox1.Items.AddRange(sorted);