By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,318 Members | 2,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,318 IT Pros & Developers. It's quick & easy.

SetSelected for a listbox does not select multiple items.

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 03/05/2005 Henry Padilla wrote:
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?
--
DaveG - Crawling along the learning curve.
Nov 21 '05 #2

P: n/a
"DaveG" <ne*******@daveg.no.nospam> wrote in message
news:jv*******************@news4.e.nsc.no...
On 03/05/2005 Henry Padilla wrote: -- snip -- Have you set the Listbox selectionMode to either multiSimple or
MultiExtended?
--
DaveG - Crawling along the learning curve.


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.
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.