Results 1 to 3 of 3

Thread: Scrolling in a text box without Scroll Bars

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Glasgow, Scotland
    Posts
    71

    Scrolling in a text box without Scroll Bars

    I want to be able to scroll the contence of a text box by clicking a command button the same way as if I was using the scroll bar. Is there an API call to do this.

    Thanks for any help,

    Chris

  2. #2
    Matthew Gates
    Guest
    How about:


    VB Code:
    1. Private Sub Command1_Click()
    2.     Text1.SetFocus
    3.     SendKeys "{DOWN}"
    4. End Sub

  3. #3
    jim mcnamara
    Guest
    Look up using the ScrollWindow() api function. It scrolls windows.

    Code:
    Private Type RECT
    	Left As Long
    	Top As Long
    	Right As Long
    	Bottom As Long
    End Type
    myRect as RECT
    Private Declare Function ScrollWindow Lib "user32" (ByVal hWnd As Long, ByVal XAmount As Long, ByVal YAmount As Long, lpRect As RECT, lpClipRect As RECT) As Long
    with myRect
       .left = 1
       .right = Text1.Width -2
       .top = 1
       .bottom = text1.height - 2
       ' negative scrolls the text towards the top of the screen
    retval = ScrollWindow(Text1.hWnd, 0, -140,myRect, 0)

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