Share via


TextDocument.ClearBookmarks Method

Removes all unnamed bookmarks in the text document.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
Sub ClearBookmarks
'Usage
Dim instance As TextDocument

instance.ClearBookmarks()
void ClearBookmarks()
void ClearBookmarks()
function ClearBookmarks()

Remarks

The following examples look in a document (like a text file) for the word, int. If it is found, a bookmark is placed on its line. The examples then use the ClearBookmarks method to delete the bookmarks.

To run the following example, first either create or open a document that contains the word, int.

Examples

Sub ClearBookmarksExample(ByVal dte As EnvDTE.DTE)
    Dim objTD As TextDocument

    objTD = dte.ActiveDocument.Object
    MsgBox("Selection: " & objTD.Selection.Mode.ToString)
    If Not objTD.MarkText("int") Then
        MsgBox("""int"" not found.")
    Else
        MsgBox("Note that unnamed bookmarks have been placed on lines _
        containing ""int"".")
        objTD.ClearBookmarks()
    End If
End Sub
public void ClearBookmarksExample(_DTE dte)
{
    TextDocument td;

    td = (TextDocument)dte.ActiveDocument.Object("");
    MessageBox.Show ("Selection: " + td.Selection.Mode.ToString ());
    if (td.MarkText ("int", (int)vsFindOptions.vsFindOptionsNone) == 
    false)
        MessageBox.Show ("\"int\" not found.");
    else
    {
        MessageBox.Show ("Note that unnamed bookmarks have been placed 
        on lines containing \"int\".");
        td.ClearBookmarks ();
    }
}

.NET Framework Security

See Also

Reference

TextDocument Interface

TextDocument Members

EnvDTE Namespace