This documentation is archived and is not being maintained.

EqualTo Method (General Extensibility)

Visual Studio .NET 2003

Returns whether the value of the called object's AbsoluteCharOffset Property is equal to that of the given object.

[Visual Basic .NET]
Public Function EqualTo( _
   ByVal Point As TextPoint _
) As Boolean
[Visual Basic 6]
Function EqualTo( _
   ByVal Point As TextPoint _
) As Boolean
HRESULT __stdcall EqualTo(
   TextPoint* Point,
   /* [out, retval] */ VARIANT_BOOL* retVal
public bool EqualTo(
   TextPoint Point
[JScript .NET]
public function EqualTo(
   Point : TextPoint
) : Boolean


Required. A TextPoint Object to compare to the current edit point.

Return Value

Returns True if Point has the same AbsoluteCharOffset property value as the edit point. EqualTo returns False if Point is not in the same document as the edit point.


With the VirtualPoint Object, EqualTo compares the virtual positions if the argument is a VirtualPoint, otherwise it compares the "physical" positions.


Sub EqualToExample()
   Dim epStart As EditPoint
   Dim epEnd As EditPoint
   Dim objTextDoc As TextDocument
   Dim iCtr As Integer

   ' Create a new text file.
   DTE.ItemOperations.NewFile("General\Text File")

   ' Set references to the new document and create EditPoints.
   objTextDoc = DTE.ActiveDocument.Object("TextDocument")
   epStart = objTextDoc.StartPoint.CreateEditPoint
   epEnd = objTextDoc.EndPoint.CreateEditPoint

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

   ' Move Start EditPoint to the top of the doc, End 
   ' EditPoint to the end, and then check their positions.
   CheckPt(epStart, epEnd)

   ' Move Start EditPoint to the end of the doc and
   ' then check their positions again.
   CheckPt(epStart, epEnd)
End Sub

Sub CheckPt(ByVal epStart As EditPoint, ByVal epEnd As EditPoint)
   ' Checks the position of Start and End EditPoints.
   If epStart.LessThan(epEnd) Then
      MsgBox("Starting EditPoint comes before End EditPoint.")
   ElseIf epStart.GreaterThan(epEnd) Then
      MsgBox("Starting EditPoint comes after End Editpoint.")
   ElseIf epStart.EqualTo(epEnd) Then
      MsgBox("Starting EditPoint and End EditPoint are in the same place.")
   End If
End Sub

See Also

Applies To: EditPoint Object | TextPoint Object | VirtualPoint Object