471,319 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

SetSelected for a listbox does not select multiple items.

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
2 2489
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
"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.

Similar topics

3 posts views Thread by Peter Mancini | last post: by
1 post views Thread by sab | last post: by
6 posts views Thread by Max | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.