Export (0) Print
Expand All
Cut
Run
Expand Minimize

LessThan Method (General Extensibility)

Visual Studio .NET 2003

Returns whether the value of the called object's AbsoluteCharOffset Property is less than that of the given object.

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

Parameters

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

Return Value

Returns True if Point has a lesser AbsoluteCharOffset property value compared to the EditPoint Object's AbsoluteCharOffset property. LessThan returns False if Point is not in the same document as the current document.

Remarks

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

Example

Sub LessThanExample()
   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.
   epStart.StartOfDocument()
   epEnd.EndOfDocument()
   CheckPt(epStart, epEnd)

   ' Move Start EditPoint to the end of the doc and
   ' then check their positions again.
   epStart.EndOfDocument()
   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.")
   Else
      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

Show:
© 2014 Microsoft