Results 1 to 3 of 3

Thread: Listboxes

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    33
    I have a list box with a bunch of things in it, im using checkbox style and multiselect how can i get vb to return the selected items to me?

    ex: in a listbox we have this

    apple
    orange
    bananna
    pear

    the user selects pear and apple

    i want to be able to click a button and have it say
    apple; pear or anythign that has the selected items in it

  2. #2
    Lively Member
    Join Date
    Mar 2000
    Posts
    87
    Dim i As Integer

    For i = 0 To List1.ListCount - 1
    If List1.Selected(i) Then
    MsgBox List1.List(i) & " is selected"
    End If
    Next i

  3. #3
    Hyperactive Member jeba's Avatar
    Join Date
    Feb 2000
    Posts
    265

    something like this..

    Hi!
    Code:
    Private Sub Command1_Click()
    Dim selectedthings As String
    For i = 0 To List1.ListCount - 1
    If List1.Selected(i) = True Then
    selectedthings = selectedthings & List1.List(i) & vbNewLine
    End If
    Next
    MsgBox "Selected Items are " & vbnewline & selectedthings
    End Sub
    Does that help u?
    Jeba.

    [Edited by jeba on 06-20-2000 at 01:59 AM]
    J£ßä

Posting Permissions

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



Click Here to Expand Forum to Full Width