Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    North Dakota, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    listbox items selected property (2000)

    I have 2 multi-select listboxes on a form.
    lstA
    lstB

    I need a if...then statement that does the following.

    IF lstA has items selected THEN
    do a procedure
    END IF

    IF lstB has items selected THEN
    do another procedure
    END IF


    What property is used for lstA and lstB or of the form that designates if a listbox has items selected?

    Thanks.
    Sarah

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: listbox items selected property (2000)

    You can use the ItemsSelected collection to check whether any items are selected, and if so, which.

    If lstA.ItemsSelected.Count > 0 Then
    ...
    End If

    Dim v As Variant
    For Each v In lstA.ItemsSelected
    ' Do something with selected item
    MsgBox lstA.ItemData(v)
    Next v

  3. #3
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    North Dakota, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: listbox items selected property (2000)

    Hey thanks, Hans.

    That's the property I needed and it works like I need it to.

    Sarah

Posting Permissions

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