Is there a way to get the scroll bar position (vertical & horizontal) of any VB control that uses it (i.e. TEXT CONTROL) ?
Printable View
Is there a way to get the scroll bar position (vertical & horizontal) of any VB control that uses it (i.e. TEXT CONTROL) ?
I assume your talking about getting the position of a multi-line
textbox scrollbar, for example?
To accomplish that you would probably need to use some APIs.
Why not just determine the line the cursor is on instead (or column position)?
This won't solve all the problem, but it is simpler than using the APIs.
Actually, I need to use this functionality to a dbGRID control instead of a text box control. My problem is when I refresh the grid which is bounded to an ADODC1, the whole grid shifts down and it confuses the USERS.
If I could only get hold of where the scroll bar is prior to the refresh and bring it back to that position aft5erwards so that the grid relative to the screen stays the same.
Try the ScrollBar api functions.
GetScrollPos and SetScrollPos
GetScrollInfo and SetScrollInfo
Since you are using the dbgrid, use the .TopRow property to
determine the visible row that is at the top position of the grid.
Store that in a var and after the refresh set the .TopRow equal to
the value in the var. Easier.
I used both GetScrollPos & GetScrollInfo, doesn't seem to work for a third party VB control. I'm using Sheridan DataWidgets 3.12. I get a dll error of 1447 (the window does not have scroll bars).Quote:
GetScrollPos and SetScrollPos
GetScrollInfo and SetScrollInfo
If I use any MS VB controls with scroll bars, there's no problem.