C # Combobox moves item to end of list

I need to add "Select more ..." at the bottom of the list items, for example, on the SQL 2008 server selector. Attempt:

        List<string> srvList = new List<string>();
        srvList.Add("ff");
        srvList.Add("jj");
        srvList.Add("pp");
        srvList.Add("<Select more...>");
        ComboBoxServs.Items.AddRange(srvList.ToArray<String>());

But the inscription "Choose more ..." appears at the top of the elements.

+5
source share
2 answers

As MSDN says:

If the Sorted property of the ComboBox is set to true, the items are inserted into the list in alphabetical order . Otherwise, items are inserted in the order in which they appear inside the array.

Try setting the property Sortedto false:

    ComboBoxServs.Sorted = false;
    List<string> srvList = new List<string>();
    srvList.Add("ff");
    srvList.Add("jj");
    srvList.Add("pp");
    srvList.Add("<Select more...>");
    ComboBoxServs.Items.AddRange(srvList.ToArray<String>());
+3
source

Insert Combobox control

 myComboBox.Items.Insert(0, "Select more");

, .

0

All Articles