Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

SelectedIndex – PB Docs 2021 – PowerBuilder Library

SelectedIndex – PB Docs 2021

SelectedIndex

PowerScript function

Description

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

Applies to

ListBox, ListView, and RibbonComboBoxItem controls

Syntax

Argument

Description

listcontrolname

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

Return value

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:

These statements return the index of the selected item in the
RibbonBar ComboBox:

See also

SelectedItem


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