HELP PLEASE - Selecting items from ONE ListView and Populating another 
Author Message
 HELP PLEASE - Selecting items from ONE ListView and Populating another

I have TWO ListView controls on separate forms

ListView 1 is a ListView control (with checkboxes) on which presents a
list of people's names.  From this list, the user should be able to select
one or more person who form a 'team' by selecting them with the
checkbox.  When the user clicks the 'Add' button, I need all
of the entries selected by the user to be populated in the
second ListView control (ListView 2) which is also set up with
checkboxes.

I am using this code in the 'Add' button but I'm getting an 'Index out of
bounds' error message.  Can anyone tell me if this is the correct way of doing
this?? I don't see a lot of sample code out there for this.

THANKS!!

------------------------------------------------------------------------------------------------
Private Sub cmdAddMembers_Click()

    'Variable declaration
    Dim lvITEM As MSCELISTVIEWLibCtl.ListItem

    Dim strRecordKey As String
    Dim i As Integer

    For i = 0 To lvwPeople.ListItems.Count - 1
        If ListViewItemIsChecked(m_ListhWnd, i) Then
            'add the list item
            Set lvITEM = frmMainMenu.lvwTeamMembers.ListItems.Add(, lvwPeople.ListItems(i).Key, lvwPeople.ListItems(i).Text)
        End If
    Next i

    'Dismiss the Select Team Members dialog.
    frmTeamMembers.Hide

    'Refresh the ListBox on the Main Menu
    frmMainMenu.lstTeamMembers.Refresh

End Sub
---------------------------------------------------------------------------------------------------



Fri, 27 Aug 2004 18:57:52 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. How to select just one item in a ListView with MultiSelection by program code

2. jump listview to the hilight item (selected item)...

3. Why does the previous selected item in a ListView get selected for a short moment

4. HELP please--populating a listview (VB5)

5. Listview Control - moving items from one listview to another

6. ListView control - Keeping selected items looking selected

7. populating vb.net listbox from selected items of another listbox

8. select item in list, populate dbgrid

9. Please help,trying to put selected items from array into list box

10. please help,trying to put selected items from array into list box

11. How Com Listview Sub Item Populates so Slowly?

12. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

 

 
Powered by phpBB® Forum Software