Results 1 to 4 of 4

Thread: [RESOLVED] Adding all items from a listview to a listbox?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Posts
    2,295

    Resolved [RESOLVED] Adding all items from a listview to a listbox?

    Hey guys I have two forms.

    The antivirus form has a listview called report.

    I have another form called antiignore that has a list1 listbox. Is there a way to get it so when I load the antiignore form, the items that are in the listview report goes in the list1?

    Thank you!

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Adding all items from a listview to a listbox?

    You want to transfer every item from the ListView to the ListBox? Which column do you want to transfer from the ListView? Should the items stay in the ListView?

    Try this to see if it's what you want, otherwise, explain what it is you want a little more.

    Code:
    Private Sub LVTransferAll(ByRef LVObject As Object, _
        ByRef LBObject As Object)
        
        Dim l As Long, c As Long
        With LVObject
            c = .ListItems.Count
            If c > 0 Then
                'LBObject.Clear 'Uncomment to clear ListBox first.
                For l = 1 To c
                    LBObject.AddItem .ListItems(l).Text
                Next l
            End If
        End With
    End Sub
    And to use it...

    vb Code:
    1. 'Example:
    2. Private Sub Command1_Click()
    3.     LVTransferAll report, list1
    4. End Sub

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Posts
    2,295

    Re: Adding all items from a listview to a listbox?

    Thanks alot dude!

  4. #4
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: [RESOLVED] Adding all items from a listview to a listbox?

    No problem.

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