Listview : MultiSelect problem 
Author Message
 Listview : MultiSelect problem

One of several ways:

Option Explicit

Private Const LVM_FIRST = &H1000
Private Const LVIS_SELECTED = &H2

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
    (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
    lParam As Any) As Long

Private Sub Command1_Click()
Dim cnt As Long
Dim SelCount As Long
Dim SelectedItemText As String
Dim SelectedItemIndex As Long
Dim i As Long

    With ListView1
        SelCount = SendMessage(.hwnd, LVM_GETSELECTEDCOUNT _
        , 0&, ByVal 0&)

        For cnt = 1 To .ListItems.Count
            If SendMessage(.hwnd, LVM_GETITEMSTATE, cnt, _
                ByVal LVIS_SELECTED) And LVIS_SELECTED Then
                i = i + 1
                SelectedItemIndex = .ListItems(cnt).Index
                SelectedItemText = .ListItems(cnt).Text
                '(Code for subitems, if applicable)

                '(Process the returned variables)

                If i = SelCount Then Exit For
            End If

    End With

End Sub



> How can I know the number and the name of the several items that a user
> has selected in my ListView. I've set the MultiSelect property to True.

Sun, 17 Aug 2003 06:04:17 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Multiselected Listview problem

2. ListView???? MultiSelect

3. ListView MultiSelect Drag Events

4. HELP: listview multiselect

5. ListView MultiSelect Bug

6. SelectedItem w/ MultiSelect ListView

7. Listview drag and drop bug in icon mode when multiselect=true

8. Listview Multiselect

9. MultiSelect in ListView control

10. MultiSelect of listview

11. whoops - multiselect a listview !

12. ListView: Qty Selected in Multiselect Mode


Powered by phpBB® Forum Software