This documentation is archived and is not being maintained.

SetBookmark Method (General Extensibility)

Visual Studio .NET 2003

Sets an unnamed bookmark on the current line in the buffer.

[Visual Basic .NET]
Public Sub SetBookmark() 
[Visual Basic 6]
Sub SetBookmark() 
[C++]
HRESULT __stdcall SetBookmark();
[C#]
void SetBookmark();
[JScript .NET]
public function SetBookmark()

Example

Sub SetBookmarkExample()
   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: