ListBox Selected

B

Bruce F

I have a multiselect ListBox and I want to determine which items are
selected.
I don't want to use "SelectedItems" but want to loop through all items
and check if selected or not.

What I want is:

For i = 0 To ListBox1.Items.Count
' code to check if item(i) is selected
Next

As a Newbie, I am having trouble finding correct code to do this.
 
A

ActiveX

I dont understand why you arent want to use SelectedItems. There are one or
more indirect ways but in majority they are likely to same.
But altough if you want, you can use this;

for i=0 to listbox1.items.count-1
if listbox1.selecteditems.contains(listbox1.items(i))=true then
'if it is selected
else
' if its not
end if
next

Serkan
 

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