This documentation is archived and is not being maintained.

PreviousBookmark Method (General Extensibility)

Visual Studio .NET 2003

Moves the edit point or text selection to the location of the previous bookmark in the document.

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

Return Value

Returns True if the edit point moves to a previous bookmark, False if not.

Remarks

If there are no more bookmarks, the edit point is not moved.

PreviousBookmark moves the TextSelection object to the location of the first bookmark preceding the location of the active end of the TextSelection. The TextSelection is collapsed at the new location.

Example

Sub PreviousBookmarkExample()
   Dim objTextDoc As TextDocument
   Dim objEditPt As EditPoint, iCtr As Integer
        
   'Create a new text file.
   Call 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.StartOfDocument()
   'Set some bookmarks.
   objEditPt.LineDown(1)
   'Set the first bookmark.
   objEditPt.SetBookmark()
   'Set the second bookmark on the next line.
   objEditPt.LineDown(1)
   objEditPt.SetBookmark()
   'Go back to the first bookmark.
   objEditPt.PreviousBookmark()
   'Plug in some text there.
   objEditPt.Insert("BOOKMARK 1: ")
   'Do the same thing at the next bookmark.
   objEditPt.NextBookmark()
   objEditPt.Insert("BOOKMARK 2: ")
End Sub

See Also

Applies To: EditPoint Object | TextSelection Object

Show: