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

Syntax 2 When you know the item number – PB Docs 126 – PowerBuilder Library

Syntax 2 When you know the item number – PB Docs 126

Syntax 2 When you know the item number

Description

Finds and highlights an item in a ListBox when you can specify
the index number of the item. You can also clear the selection by
specifying zero as the index number.

Controls

ListBox, DropDownListBox, PictureListBox, and DropDownPictureListBox controls

Syntax

Argument

Description

listboxname

The name of the ListBox control in which
you want to select an item

itemnumber

An integer whose value is the location
(index) of the item in the ListBox or the ListBox portion of the
drop-down list.

Specify 0 for itemnumber to clear the
selected item. For a ListBox or PictureListBox, 0 removes highlighting
from the selected item. For a DropDownListBox or DropDownPictureListBox,
0 clears the text box.

Return Values

Integer. Returns the index number of
the selected item. SelectItem returns 0 if itemnumber is
not valid or if you specified 0 in order to clear the selected item. It
returns -1 if an error occurs. If any argument’s value
is null, SelectItem returns null.

Usage

To find an item but not select it, use the FindItem function.

note.png MultiSelect ListBoxes

SelectItem has no effect on a ListBox or
PictureListBox whose MultiSelect property is true.
Instead, use SetState to select items without
affecting the selected state of other items in the list.

note.png Clearing the text box of a drop-down list

To clear the text box of a DropDownListBox or DropDownPictureListBox
that the user cannot edit, set itemnumber to
0. Setting the control’s text to the empty string does
not work if the control’s AllowEdit property is false.

Examples

This example highlights item number 5:

This example clears the selection from the text box
of the DropDownListBox ddlb_choices and
sets li_Index to 0:

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