MultiSelect Property

See Also7XRO06E                 Example7XRNWI>Low

Applies To

File list box1M6S8UX, list boxG11UCK.


Specifies whether a user can make multiple selections in a file list box or list box and how the multiple selections can be made.  Read-only at run time.


[form.]{ filelistbox|listbox}.MultiSelect


The MultiSelect property settings are:

Setting             Description


0                     (Default) Multiple selection is not allowed.

1                     Simple multiple selection.  A click or the Spacebar selects or deselects an item in the list.  (Arrow keys move the pre-select focus.)

2                     Extended multiple selection.  Shift+click or Shift+arrow key extends the selection from the previously selected item to the current item.  Ctrl+click selects or deselects an item in the list.


Data Type


See Also


AddItem Method2BIX3OB

Clear MethodPMJHM6

List PropertyBKCX6E

ListCount Property4E91QN

NewIndex PropertyIOGOXY

RemoveItem MethodM867OS

Selected PropertyKC8D7W

TopIndex Property2EAX0Z


Programmer's Guide:

Chapter 3, "Creating and Using Controls"

MultiSelect, Selected Properties Example

The example fills a list box with the names of your screen fonts and illustrates how the MultiSelect property affects the behavior of a list box.  To try the example, create two list boxes and a command button on a form.  In the first list box, set MultiSelect to 1 or 2.  At run time, select several items in the first list and then click the command button.  All selected items appear in the second list box.  Run the example several times with different settings of the MultiSelect property.  Copy the code into the Declarations section and press F5 to run the program.

Sub Form_Load ()
  Dim I                            ' Declare variable.
  ' Fill the list with screen font names.
  For I = 0 To Screen.FontCount - 1
    List1.AddItem Screen.Fonts(I)
  Next I
End Sub

Sub Command1_Click ()
  Dim I                            ' Declare variable.
  ' Clear all items from the list.
  ' If an item is selected, add it to List2.
  For I = 0 To List1.ListCount - 1
    If List1.Selected(I) Then
      List2.AddItem List1.List(I)
    End If
  Next I
End Sub