SelectedIndex – PB Docs 126

SelectedIndex PowerScript function

Description

Obtains the number of the selected item in a ListBox or ListView
control.

Controls

ListBox and ListView controls

Syntax

Argument

Description

listcontrolname

The name of the ListBox or ListView control
in which you want to locate the selected item

Return Values

Integer. Returns the index of the selected
item in listcontrolname. If more than one item
is selected, SelectedIndex returns the index
of the first selected item. If there are no selected items or an
error occurs, SelectedIndex returns -1. If listcontrolname is null,
SelectedIndex returns null.

Usage

SelectedIndex and SelectedItem are
meant for lists that allow a single selection only (when the MultiSelect
property for the control is false).

When the MultiSelect property is true, SelectedIndex gets
the index of the first selected item only. Use the State function,
instead of SelectedIndex, to check each item
in the list and find out if it is selected. Use the Text function
to get the text of any item in the list.

Examples

If item 5 in lb_actions is
selected, then this example sets li_Index to
5:

These statements open the window w_emp if
item 5 in lb_actions is selected:

See Also


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x