Select entire row in ListView 
Author Message
 Select entire row in ListView

Hello all,

I am using the ListView control in Report mode and I want to select a
complete row (ie all Columns) and show it too.
Does anyone know where I can find some sample-code about this.
The sample-code from the MS KB is in C++ and I cannot read that.

Thanks in advance.

Regards,

Eric
Using VB5 Pro on Win95 / WinNT



Fri, 15 Sep 2000 03:00:00 GMT  
 Select entire row in ListView

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal
hwnd As Long, ByVal msg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const LVM_FIRST = &H1000
Private Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
Private Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
Private Const LVS_EX_FULLROWSELECT = &H20
Public Sub ExtendLine(lv As ListView)
 '**********************************************************
    'API call to extend selection bar across the ListView control.
    '**********************************************************
    Dim dwStyle As Long
    On Error Resume Next
    'Get current list view style
    dwStyle = SendMessage(lv.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, ByVal 0&)
    'Set full row select style bit
    dwStyle = dwStyle Or LVS_EX_FULLROWSELECT
    'Set new list view style
    SendMessage lv.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ByVal dwStyle
End Sub

Call ExtendLine on Got Focus of the ListView or there is another way as well
but just email me if you want it (it is a slightly better way) I have a meeting
now.  Gotta go.

Clint LaFever
Software Engineer
SAIC



Fri, 15 Sep 2000 03:00:00 GMT  
 Select entire row in ListView

Clint,

YES, that is exactly what I was looking for.
Thanks for the quick answer.

Eric

-- original message --


Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal
hwnd As Long, ByVal msg As Long, ByVal wParam As Long, lParam As Any) As
Long
Private Const LVM_FIRST = &H1000
Private Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
Private Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
Private Const LVS_EX_FULLROWSELECT = &H20
Public Sub ExtendLine(lv As ListView)
 '**********************************************************
    'API call to extend selection bar across the ListView control.
    '**********************************************************
    Dim dwStyle As Long
    On Error Resume Next
    'Get current list view style
    dwStyle = SendMessage(lv.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, ByVal
0&)
    'Set full row select style bit
    dwStyle = dwStyle Or LVS_EX_FULLROWSELECT
    'Set new list view style
    SendMessage lv.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ByVal dwStyle
End Sub

Call ExtendLine on Got Focus of the ListView or there is another way as
well
but just email me if you want it (it is a slightly better way) I have a
meeting
now.  Gotta go.

Clint LaFever
Software Engineer
SAIC



Fri, 15 Sep 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How to select entire row in ListView ?

2. How to select entire row in Listview

3. How to select entire row in ListView ? - FullRowSelect

4. How to select entire row in ListView ?

5. Selecting entire row in Listview?

6. How to select entire row in listview control (VB5)

7. Select entire row in listview control

8. Select entire row in listview control

9. Select entire row in listview control

10. Listview - Selecting an entire row?

11. Listview: Selecting entire row

12. How to select the entire row in a listview using VB6- mscomctl32.ocx

 

 
Powered by phpBB® Forum Software