This documentation is archived and is not being maintained.

Visual Basic: RichTextBox Control

Visual Studio 6.0

GetLineFromChar Method

See Also    Example    Applies To

Returns the number of the line containing a specified character position in a RichTextBox control.



The GetLineFromChar method syntax has these parts:

Part Description
object Required. An object expression that evaluates to an object in the Applies To list.
charpos Required. A long integer that specifies the index of the character whose line you want to identify. The index of the first character in the RichTextBox control is 0.


You use the GetLineFromChar method to find out which line in the text of a RichTextBox control contains a certain character position in the text. You might need to do this because the number of characters in each line of text can vary, making it very difficult to find out which line in the text contains a particular character, identified by its position in the text.