Sorted Property Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
' This example shows how the Sorted property can be used. When you run the
' example, click the command button and choose OK to add sorted items to the
' list box. Note that the items are added out of order but are automatically
' sorted.
'
' To try this example:
' 1. Choose New Project from the File menu
' 2. Choose New Form from the File menu to create a form with:
' • List box
' • Command button
' 3. Set the Sorted property of the list box to True
' 4. Press Alt+F4 to return to the programming environment
' 5. Copy the code example below to the form module
' 6. Press F5 to run the example
DECLARE SUB AddItemSortDemo ()
SUB AddItemSortDemo ()
Msg$ = "Choose OK to add items to your list box."
MSGBOX Msg$ ' Display message
List1.ADDITEM "Luscious" ' Add the entries
List1.ADDITEM "Lucy"
List1.ADDITEM "Edwards"
List1.ADDITEM "Edmark"
List1.ADDITEM "Doo"
List1.ADDITEM "Drew"
List1.ADDITEM "Zoo"
List1.ADDITEM "Zebra"
END SUB
SUB Command1_Click ()
CALL AddItemSortDemo
END SUB