EditPoint2::MoveToAbsoluteOffset Method (Int32)
Visual Studio 2015
Moves the active point to the given 1-based absolute character offset of the document.
Assembly: EnvDTE80 (in EnvDTE80.dll)
Parameters
- Offset
-
Type:
System::Int32
Required. A character index from the start of the document, beginning at one.
Implements
EditPoint::MoveToAbsoluteOffset(Int32)This method throws an ArgumentException if the value of Offset is less than 1 or greater than the length of the file. To find the length of the file, get the AbsoluteCharOffset of EndPoint.
Warning |
|---|
All newline characters or sequences count as a single character for the purposes of this property. For example, the newline denoted in Visual Basic by vbCrLf (carriage return + line feed) counts as a single character. |
Sub MoveToAbsoluteOffsetExample() Dim objTextDoc As TextDocument Dim objEditPt As EditPoint, iCtr As Integer ' Create a new text file. DTE.ItemOperations.NewFile("General\Text File") ' Get a handle to the new document and create an EditPoint. objTextDoc = DTE.ActiveDocument.Object("TextDocument") objEditPt = objTextDoc.StartPoint.CreateEditPoint ' Insert ten lines of text. For iCtr = 1 To 10 objEditPt.Insert("This is a test." & Chr(13)) Next iCtr objEditPt.MoveToAbsoluteOffset(10) objEditPt.Insert("HELLO") objEditPt.MoveToLineAndOffset(4, 5) objEditPt.Insert("WORLD") End Sub
Show:
