Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ToolStripTextBox.GetFirstCharIndexFromLine Method

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

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public int GetFirstCharIndexFromLine(
	int lineNumber


Type: System.Int32

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

Return Value

Type: System.Int32
The zero-based character index in the specified line.

If the lineNum parameter is negative, GetFirstCharIndexFromLine returns 0. If the lineNum parameter exceeds the number of lines in the control, GetFirstCharIndexFromLine returns the first character index for the last line in the control.

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).

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft