Edit

Share via


TextBoxBase.GetFirstCharIndexFromLine(Int32) Method

Definition

Retrieves the index of the first character of a given line.

public:
 int GetFirstCharIndexFromLine(int lineNumber);
public int GetFirstCharIndexFromLine (int lineNumber);
member this.GetFirstCharIndexFromLine : int -> int
Public Function GetFirstCharIndexFromLine (lineNumber As Integer) As Integer

Parameters

lineNumber
Int32

The line for which to get the index of its first character.

Returns

The zero-based index of the first character in the specified line.

Exceptions

The value of the lineNumber parameter is less than zero.

Remarks

Line numbering in the text box starts at zero. If the lineNumber parameter is greater than the last line in the text box, GetFirstCharIndexFromLine returns -1.

GetFirstCharIndexFromLine returns the first character index of a physical line. The physical line is the displayed line, not the assigned line. The number of displayed lines can be greater than the number of assigned lines due to word wrap. For example, if you assign two long lines to a RichTextBox control and set Multiline and WordWrap to true, the two long assigned lines result in four physical (or displayed lines).

Applies to

See also