Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    52

    Unanswered: Listbox: manually select multiple items

    Hello,

    If I have a listbox me.list with the values A,B,C,

    and I would like to preselect (ie program) values A and B, how would I do that?

    I tried something like

    For i = 0 To Me.list.ListCount - 1
    If Me.list.ItemData(i) = A or me.list.itemdata(i)=B Then
    Me.list.Selected(i) = True
    End If
    Next i

    But is didn't work...

    All help appreciated!

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: Listbox: manually select multiple items

    Originally posted by ptrapp
    Hello,

    If I have a listbox me.list with the values A,B,C,

    and I would like to preselect (ie program) values A and B, how would I do that?

    I tried something like

    For i = 0 To Me.list.ListCount - 1
    If Me.list.ItemData(i) = A or me.list.itemdata(i)=B Then
    Me.list.Selected(i) = True
    End If
    Next i

    But is didn't work...

    All help appreciated!
    2 Errors

    1. If Me.list.ItemData(i) = "A"

    2. Set the multiSelect property of the Listbox to true

    it should work

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •