CurLine Property

Applies To

TextBox control.

Description

Specifies the current line of a control.

Syntax

object.CurLine [= Long]

The CurLine property syntax has these parts:

Part

Description

object

Required. A valid object.

Long

Optional. Specifies the current line of a control.


Remarks

The current line of a control is the line that contains the insertion point. The number of the first line is zero.

The CurLine property is valid when the control has the focus.

Example

The following example tracks the CurLine, CurTargetX, and CurX property settings in a multiline TextBox. These settings change in the KeyUp event as the user types into the Text property, moves the insertion point, and extends the selection using the keyboard.

To use this example, follow these steps:

  1. Copy this sample code to the Declarations portion of a form.
  2. Add one large TextBox named TextBox1 to the form.
  3. Add three TextBox controls named TextBox2, TextBox3, and TextBox4 in a column.
    Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, _
    ByVal Shift As Integer) TextBox2.Text = TextBox1.CurLine TextBox3.Text = TextBox1.CurX TextBox4.Text = TextBox1.CurTargetX End Sub Private Sub UserForm_Initialize() TextBox1.MultiLine = True TextBox1.Text = "Type your text here. User CTRL + ENTER to start a new line." End Sub