Auto Scrolling Controls


/ Published in: VB.NET
Save to your folder(s)

Tested on multiline textbox and listview.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.