Selected Property

Microsoft Office Outlook 2003

Show All Show All

Selected Property

Returns or sets the selection state of items in a ListBox.

Syntax

object.Selected( index ) [= Boolean]

The Selected property syntax has these parts:

Part Description
object Required. A valid object.
index Required. An integer with a range from 0 to one less than the number of items in the list.
Boolean Optional. Whether an item is selected.

Settings

The settings for Boolean are:

Value Description
True The item is selected.
False The item is not selected.

Remarks

The Selected property is useful when users can make multiple selections. You can use this property to determine the selected rows in a multi-select list box. You can also use this property to select or deselect rows in a list from code.

The default value of this property is based on the current selection state of the ListBox.

For single-selection list boxes, the Value or ListIndex properties are recommended for getting and setting the selection. In this case, ListIndex returns the index of the selected item. However, in a multiple selection, ListIndex returns the index of the row contained within the focus rectangle, regardless of whether the row is actually selected.

When a list box control's MultiSelect property is set to None, only one row can have its Selected property set to True.

Entering a value that is out of range for the index does not generate an error message, but does not set a property for any item in the list.