Export (0) Print
Expand All
ID
Top
Expand Minimize

AbsoluteCharOffset Property (General Extensibility)

Visual Studio .NET 2003

Returns the one-based character offset from the beginning of the document to the object.

[Visual Basic .NET]
Public ReadOnly Property AbsoluteCharOffset() As Long
[Visual Basic 6]
Property Get AbsoluteCharOffset() As Long
[C++]
HRESULT __stdcall get_AbsoluteCharOffset(
   /* [out, retval] */ long* retVal
);
[C#]
int AbsoluteCharOffset {get;}
[JScript .NET]
public function get AbsoluteCharOffset() : int

Remarks

AbsoluteCharOffset returns the number of characters from the top of the document to the object, as compared to the LineCharOffset Property (General Extensibility), which determines the number of characters only from the beginning of the line containing the object. New line characters count as one character.

Character numbering begins at one.

Example

Sub AbsoluteCharOffsetExample()
   Dim objTextDoc As TextDocument
   Dim objTP As TextPoint, iCtr As Integer
   Dim msg As String

   ' 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")
   objTP = objTextDoc.StartPoint.CreateEditPoint

   ' Insert ten lines of text.
   For iCtr = 1 To 10
      objTP.Insert("This is a test." & Chr(13))
   Next iCtr

   ' Capitalize the third word of the second line
   objTP.StartOfDocument()
   msg = "AbsoluteCharOffset value: " & objTP.AbsoluteCharOffset & vbCr
   msg = msg & "AtEndOfDocument value: " & objTP.AtEndOfDocument & vbCr
   msg = msg & "AtEndOfLine value: " & objTP.AtEndOfLine & vbCr
   msg = msg & "AtStartOfDocument value: " & objTP.AtStartOfDocument & vbCr
   msg = msg & "AtStartOfLine value: " & objTP.AtStartOfLine & vbCr
   MsgBox(msg)
End Sub

See Also

Applies To: EditPoint Object | TextPoint Object | VirtualPoint Object

Show:
© 2014 Microsoft