Chris Wallace
Nov 5th, 2001, 04:03 AM
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
Matthew Gates
Nov 5th, 2001, 07:06 AM
How about:
Private Sub Command1_Click()
Text1.SetFocus
SendKeys "{DOWN}"
End Sub
jim mcnamara
Nov 5th, 2001, 09:56 AM
Look up using the ScrollWindow() api function. It scrolls windows.
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)