You can use the MultiSelect property to specify whether a user can make multiple selections in a list box on a form and how the multiple selections can be made.
Setting
The MultiSelect property uses the following settings.
Setting | Visual Basic | Description |
---|---|---|
None | 0 | (Default) Multiple selection isn't allowed. |
Simple | 1 | Multiple items are selected or deselected by clicking them with the mouse or pressing the SPACEBAR. |
Extended | 2 | Multiple items are selected by holding down SHIFT and clicking them with the mouse or by holding down SHIFT and pressing an arrow key to extend the selection from the previously selected item to the current item. You can also select items by dragging with the mouse. Holding down CTRL and clicking an item selects or deselects that item. |
You can set the MultiSelect property by using the list box's property sheet, a macro, or Visual Basic.
This property can be set only in form Design view.
Remarks
You can use the ListIndex property to return the index number for the selected item. When the MultiSelect property is set to Extended or Simple, you can use the list box's Selected property or ItemsSelected collection to determine the items that are selected. In addition, when the MultiSelect property is set to Extended or Simple, the value of the list box control will always be Null.
If the MultiSelect property is set to Extended, requerying the list box clears any selections made by the user.