Posted By

jshultz4 on 06/05/12


Tagged


Versions (?)

Auto Scrolling Controls


 / Published in: VB.NET
 

Tested on multiline textbox and listview.

  1. #Region " Auto Scrolling"
  2. <DllImport("User32.dll", CharSet:=CharSet.Auto, EntryPoint:="SendMessage")> _
  3. Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
  4. End Function
  5.  
  6. Const WM_VSCROLL As Integer = 277
  7. Const SB_BOTTOM As Integer = 7
  8.  
  9. Private Sub ScrollToEnd(ByVal obj As Object)
  10. Dim ptrWparam As New IntPtr(SB_BOTTOM)
  11. Dim ptrLparam As New IntPtr(0)
  12. SendMessage(obj.Handle, WM_VSCROLL, ptrWparam, ptrLparam)
  13. End Sub
  14. #End Region

Report this snippet  

You need to login to post a comment.