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
HRESULT __stdcall PreviousBookmark(
   /* [out, retval] */ VARIANT_BOOL* retVal
bool PreviousBookmark();
[JScript .NET]
public function PreviousBookmark() : Boolean

Return Value

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


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.


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
   'Set some bookmarks.
   'Set the first bookmark.
   'Set the second bookmark on the next line.
   'Go back to the first bookmark.
   'Plug in some text there.
   objEditPt.Insert("BOOKMARK 1: ")
   'Do the same thing at the next bookmark.
   objEditPt.Insert("BOOKMARK 2: ")
End Sub

See Also

Applies To: EditPoint Object | TextSelection Object