Results 1 to 3 of 3

Thread: ListView

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    ListView

    How to make a ListView scroll...why doesn't this work?

    VB Code:
    1. Private Declare Function SendMessage Lib "user32" _
    2. Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As _
    3. Long, ByVal wParam As Long, lParam As Any) As Long
    4.  
    5. Const SB_LINEDOWN = 1
    6. Const SB_LINEUP = 0
    7. Const SB_PAGEDOWN = 3
    8. Const WM_VSCROLL = &H2E
    9.  
    10. Private Sub Command1_Click()
    11.   SendMessage ListView1.hwnd, WM_VSCROLL, SB_LINEDOWN, 0&
    12. End Sub
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2
    Frenzied Member
    Join Date
    Aug 2001
    Posts
    1,075
    This code works for me...

    VB Code:
    1. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
    2.  
    3. Private Sub Form_Click()
    4. '     Send a WM_VSCROLL message 0 is up and 1 is down
    5. '     SendMessage tvwFTPDir.hWnd, 277&, 0&, vbNull
    6.  
    7.       SendMessage ListView1.hWnd, 277&, 1&, vbNull
    8.  
    9.  
    10. End Sub
    11. Private Sub Form_Load()
    12.     Dim k As Integer
    13.     ListView1.View = lvwReport
    14.     ListView1.ColumnHeaders.Add , , "test"
    15.     For k = 1 To 20
    16.         ListView1.ListItems.Add , , Str$(k)
    17.     Next
    18. End Sub

    Greg
    Free VB Add-In - The Reference Librarian
    Click Here for screen shot and download link.

  3. #3

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Thanks alot
    My evil laugh has a squeak in it.

    kristopherwilson.com

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