-
hi,
i have just had a thought <gasp in amazment>, is it possible to detect when the scrollbar hs reached the bottom, ie the user has scrolled the object to the bottom, becasue i have a lisence agreement i want the next button to be enabled when the user has scrolled to the bottom of the page
Cheers
Merlin ?
-
I assume you want to know how to do this with a TextBox.
Then here's one way of doing it.
Add a Timer to the form and add the following code:
Code:
Private Declare Function SendMessage _
Lib "user32" Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Const EM_GETFIRSTVISIBLELINE = &HCE
Private lngLine As Long
Private Sub Form_Load()
'Load your text box with the text first!!!!
'The text you want to show must be in the text box
'before continuing with this code.
Timer1.Enabled = False
'The text box must be visible for this to work
'so if you (like in this example) add this code
'to Form_Load you must first show the form.
Me.Show
DoEvents
Text1.SelStart = Len(Text1)
DoEvents
lngLine = SendMessage( _
Text1.hwnd, _
EM_GETFIRSTVISIBLELINE, _
0&, 0&)
Text1.SelStart = 0
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
'This will enable the button (in this example called Command1)
'when the user has reached the bottom of the text
Command1.Enabled = (SendMessage( _
Text1.hwnd, _
EM_GETFIRSTVISIBLELINE, _
0&, 0&) = lngLine)
End Sub
Good luck!
-
instead of a text box which you still can use....make a picturebox with a label in it and set the label.top to match VScroll top and then you will have to set the max to match the amount of text you need to scroll before the command button is enabled..........
Private Sub VScroll1_Change()
'in the form load put this VScroll1.value = 20 or what ever 'you want it to be
'set the Button you want disabled to false
'set the text box to match the scrollbar height
VScroll1.Max = 20
VScroll1.Min = 0
If VScroll1.Min = 0 Then
Command1.Enabled = True
Else
End If
End Sub
-
that doesnt really make sense.
if the min = 0 then let the command button be enabled??
also if there is nothing to be done after the Else line, you dont need to put it in.