ListBox Selected

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bruce F

    ListBox Selected

    I have a multiselect ListBox and I want to determine which items are
    selected.
    I don't want to use "SelectedIt ems" 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.

  • ActiveX

    #2
    Re: ListBox Selected

    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.select editems.contain s(listbox1.item s(i))=true then
    'if it is selected
    else
    ' if its not
    end if
    next

    Serkan

    "Bruce F" <znotify@hotmai l.com> wrote in message
    news:e3RLSS%235 FHA.3388@TK2MSF TNGP11.phx.gbl. ..[color=blue]
    >I have a multiselect ListBox and I want to determine which items are
    >selected.
    > I don't want to use "SelectedIt ems" 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.
    >[/color]


    Comment

    Working...