Results 1 to 2 of 2

Thread: Retreiving Multiple ListBox Items

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Location
    Cleveland, OH
    Posts
    12
    Any suggestions on how to check for multiple selected items in a ListBox and pass each value to a MAPI control.

    I have no problem picking one item and this being passed correctly, but I'm having problems with multiple selection of items. I have been fighting with a For-Next loop trying to test each value as selected or not. Any sample code would be much appreciated.

    Sincerely,
    Shawn Martin
    Ecopic Corporation
    [email protected] - work
    [email protected] - home

  2. #2
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    Here's an example that copies all the checked items from a ListBox to a ComboBox when you click a CommandButton.
    Requires: A ListBox with Style = 1 (Checked), a ComboBox with Style = 2 (Dropdown List) and a CommandButton.
    Code:
    Private Sub Command1_Click()
        Dim I As Integer
        
        Call Combo1.Clear
        For I = 0 To List1.ListCount - 1
            If List1.Selected(I) Then Call Combo1.AddItem(List1.List(I))
        Next
    End Sub
    
    Private Sub Form_Load()
        Dim I As Integer
        
        For I = 1 To 10
            Call List1.AddItem("Item " & I)
        Next
    End Sub

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