This documentation is archived and is not being maintained.

GoToLine Method

Visual Studio .NET 2003

Moves to the beginning of the indicated line and selects the line if requested.

[Visual Basic .NET]
Public Sub GotoLine( _
   ByVal Line As Integer, _
   Optional ByVal Select As Boolean = False _
) 
[Visual Basic 6]
Sub GotoLine( _
   ByVal Line As Long, _
   Optional ByVal Select As Boolean = False _
) 
[C++]
HRESULT __stdcall GotoLine(
   long Line,
   VARIANT_BOOL Select
);
[C#]
public void GotoLine(
   int Line,
   bool Select
);
[JScript .NET]
public function GotoLine(
   Line : int,
   Select : Boolean
)

Parameters

Line
Required. The line number to go to, beginning at one.
Select
Optional. Indicates whether the target line should be selected. The default is False.

Remarks

GotoLine has the same effect as TextSelection.MoveToLineAndOffset(Line, 0, False). If Select is True, then GoToLine also performs EndOfLine(True).

Example

Sub GotoLineExample()
   ' Before running this example, open a text document.
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection
   ' Go to first line in document and select it.
   objSel.GotoLine(1, True)
End Sub

See Also

Applies To: TextSelection Object

Show: