locked
Alphabetical order in a listbox RRS feed

  • Question

  • How can I place the items of a listbox in alphabetical order?
    Saturday, July 19, 2014 2:20 PM

Answers

  • Hello,

    Select the ListBox then the property window for the ListBox and locate the property Sorted and set to True.

    Now if we enter the following one by one they are a-z sorted

    For Each Item In System.Globalization.CultureInfo _
        .CurrentCulture.DateTimeFormat.AbbreviatedDayNames.ToList
        ListBox1.Items.Add(Item)
    Next

    Or this too

    ListBox1.DataSource =
        System.Globalization.CultureInfo _
        .CurrentCulture.DateTimeFormat.AbbreviatedDayNames.ToList
    


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

    Saturday, July 19, 2014 2:27 PM