共用方式為


TextSelection.GotoLine(Int32, Boolean) Method

Definition

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

void GotoLine(int Line, bool Select = false);
[System.Runtime.InteropServices.DispId(32)]
public void GotoLine (int Line, bool Select = false);
[<System.Runtime.InteropServices.DispId(32)>]
abstract member GotoLine : int * bool -> unit
Public Sub GotoLine (Line As Integer, Optional Select As Boolean = false)

Parameters

Line
Int32

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

Select
Boolean

Optional. Indicates whether the target line should be selected. The default is false.

Attributes

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  

Remarks

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

Applies to