SetSelected for a listbox does not select multiple items.

H

Henry Padilla

I'm trying to select multiple items in a listbox and the demo from the help
file is not working. What do I do to select multiple items in a listbox?

Code sample below.
Tom P.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For Each SelectedValue In ColumnInfo.Tables(2).Rows
Index = ValuesListBox.FindStringExact(SelectedValue("VALUE_S"))
If Index >= 0 Then
ValuesListBox.SetSelected(Index, True)
End If
Next
 
D

DaveG

I'm trying to select multiple items in a listbox and the demo from
the help file is not working. What do I do to select multiple items
in a listbox?

Code sample below.
Tom P.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For Each SelectedValue In ColumnInfo.Tables(2).Rows
Index = ValuesListBox.FindStringExact(SelectedValue("VALUE_S"))
If Index >= 0 Then
ValuesListBox.SetSelected(Index, True)
End If
Next


Have you set the Listbox selectionMode to either multiSimple or
MultiExtended?
 
H

Henry Padilla

DaveG said:
On 03/05/2005 Henry Padilla wrote: -- snip --
Have you set the Listbox selectionMode to either multiSimple or
MultiExtended?

Yes, I did. And sorry for not posting feedback.

This happens if you SetSelected BEFORE the control is added to the form.
For some reason, when it is added to the form, it resets it's selections.

I put in a public "Setup" function and called it after the control was added
to the form and it works perfectly.

Tom P.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top