selected( )
Topic group Related topics Example
Returns the currently selected item(s) in an object, or checks if a specified item is selected.
Syntax
<oRef>.selected([<item expN>])
<oRef>
A reference to the object you want to check.
<item expN>
The item number to check. If omitted, the currently selected item(s) are returned. This parameter is allowed only for the ListBox control; the Grid method takes no parameters.
Property of
Grid, ListBox
Description
Calling selected( ) with no parameters returns the control’s currently selected item or items. If a listbox’s multiple property is false, selected( ) returns the currently selected item in the listbox. If multiple is true, selected( ) returns an array containing the currently selected items, one element per selection.
For a grid, selected( ) returns bookmarks to the row or rows (in an array) that are selected when rowSelect or multiSelect are true.
For a ListBox, selected( ) also returns bookmarks when the datasource is a field object.
As with any Array object, check its size property to determine how many items have been selected. The items in the selected( ) array are listed in the order they were selected.
If you specify <item expN>, selected( ) will return the prompt string for that numbered item if the item is selected, or an empty string if the item is not selected.
The ListBox object’s value property contains the value of the item that currently has focus, whether it’s selected or not.