Get the Index of the first Visible Line (or character) in a text control

Category:
Forms and Controls
Type:
Snippets
Difficulty:
Intermediate
Author:
Intelligent Solutions Inc.

Version Compatibility:

More information:
For a multline edit control, this function can tell you what the the number of the first visible line. Lines are numbered beginning with 0.

For a single line edit control, the function will return the position of the first visible character (again, numbering starts with 0).

The function is written so it will work with Text Boxes, Rich Text Boxes, and other controls which expose a similar interface.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: