multisimple listbox.selectedindex

.paul.

Well-known member
Joined
May 22, 2007
Messages
212
Programming Experience
1-3
i have a multisimple listbox.
if i have 5 items in the listbox & i select the 5th, the selectedindex reported in the listbox_SelectedIndexChanged event is 4.
if as a second selection i choose the 1st item, selectedindex = 0
so far no problem.
if i next choose any other item, while the 1st item is still selected, the selectedindex reported in the listbox_SelectedIndexChanged event is always 0.
anyone know what i'm doing wrong?
 
From the documentation for the ListBox.SelectedIndex Property:

If the SelectionMode property of the ListBox is set to either SelectionMode.MultiSimple or SelectionMode.MultiExtended (which indicates a multiple-selection ListBox) and multiple items are selected in the list, this property can return the index to any selected item.

To retrieve a collection containing the indexes of all selected items in a multiple-selection ListBox, use the SelectedIndices property. If you want to obtain the item that is currently selected in the ListBox, use the SelectedItem property. In addition, you can use the SelectedItems property to obtain all the selected items in a multiple-selection ListBox.
 
thanks.
i'm trying sendmessage - LB_GETCARETINDEX
i think it returns the listindex with the focus - i hope
 
Back
Top