Partager via


TextSelection.GotoLine Method

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

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
Sub GotoLine ( _
    Line As Integer, _
    Select As Boolean _
)
void GotoLine(
    int Line,
    bool Select
)
void GotoLine(
    [InAttribute] int Line, 
    [InAttribute] bool Select
)
abstract GotoLine : 
        Line:int * 
        Select:bool -> unit
function GotoLine(
    Line : int, 
    Select : boolean
)

Parameters

  • Line
    Type: System.Int32

    Required. The line number to go to, beginning at one.

  • Select
    Type: System.Boolean

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

Examples

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

.NET Framework Security

See Also

Reference

TextSelection Interface

EnvDTE Namespace