Is there a way to get the scroll bar position (vertical & horizontal) of any VB control that uses it (i.e. TEXT CONTROL) ?
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.
VB/Office Guru™ (AKA: Gangsta Yoda™®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (VBA, VB 6, VB.NET, C#)
Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Star Wars Gangsta Rap • Reps & Rating Posts • VS.NET on Vista (New) • Multiple .NET Framework Versions (New) • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007
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.
VB/Office Guru™ (AKA: Gangsta Yoda™®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (VBA, VB 6, VB.NET, C#)
Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Star Wars Gangsta Rap • Reps & Rating Posts • VS.NET on Vista (New) • Multiple .NET Framework Versions (New) • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007
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).GetScrollPos and SetScrollPos
GetScrollInfo and SetScrollInfo
If I use any MS VB controls with scroll bars, there's no problem.