Setting Bookmarks

Tips Search

Setting Bookmarks

  • Comments 18

Keyboard:  CTRL + K, CTRL + K (toggle bookmark)
Menu:  Edit -> Bookmarks -> Toggle Bookmark
Command:  Edit.ToggleBookmark
Versions:  2008,2010
Published:  7/5/2010
Code:  vstipTool0047


Bookmarks are a pretty cool feature that a lot of people don't seem to know about.  Essentially, Bookmarks are a way to mark locations in your code.  Unlike tokens ("TODO's"), Bookmarks are not stored with the source code.  There are numerous ways to set a Bookmark.  The simplest way is to use CTRL + K, CTRL + K to create a single Bookmark:



When you set a Bookmark it will create a glyph in the Margin and create an entry in the Bookmarks Window:



The good news is you don't have to keep the default name that is given for the Bookmark.  Just RIGHT CLICK the entry in the window and choose "Rename":



Then put in whatever you want for the name and you are good to go:



You can continue to use this method or the menu to create Bookmarks.  Another cool way to create Bookmarks is to use the "Bookmark All" (bottom right) button in the Quick Find dialog (CTRL + F):


  • The biggest issue with bookmarks is they are linked to line number, not lines of code like a breakpoint. So if you place a bookmark, then add code above it the bookmark is no longer at the same code you were trying to mark.  Bloody worthless in the real world like this and MS has closed 3 bug reports as "won't fix" because they don't think its a bug.  If breakpoints can drive with the line of code and not pin to the line number, then so can bookmarks if they wanted them to.  They just don't want to.  I liked the idea of comments.  So I defined a comment of //Bookmark: as that will stay with code and is searchable etc.

  • I have installed Visual Basic Express 2010 with hotfix ENU KB2635973 and ENU service pack 1 KB983509 (Visual Studio 2010 version 10.0.402191.1 SP1Rel).

    a) The Bookmarks icons are located in the Text Editor toolbar. There are 4 Bookmarks icons:

    a1) Toggle a bookmark on the current line (Ctrl+K,T)

    a2) Move the caret to the previous bookmark (Ctrl+K,P)

    a3) Move the caret to the next bookmark (Ctrl+K,N)

    a4) Clear all bookmarks in all files (Ctrl+K, Ctrl+L)

    b) To access to Text Editor toolbar with the Bookmarks icons:

    b1) Tools menu --> Settings --> check Expert Settings

    b2) View menu --> Toolbars --> check Text Editor

    Note: If in Tools menu --> Settings --> the Basic Settings is checked, then the Text Editor does not have Bookmarks icons.

    c) The Bookmarks are linked to lines of code like a breakpoint, not to line number. So if I place a bookmark, then add or delete code above it, the bookmark stays at the same code I marked.

    d) The Quick Find dialog has a Bookmark All button.

    d1) This button is enabled for Current Document, All Open Documents, and Current Block.

    d2) This button is disabled for Current Project and Entire Solution.

    e) After saving, closing, and reopening the project, the bookmarks are not lost. They stay in the same place I have marked them.

    f) After moving the project to a diferent folder in a different drive, the bookmarks are not lost, and they stay in the same place I have marked them.

    (E.g.: I moved the project from C:\Users\AFDBAF\Documents\Visual Studio 2010\Projects\Test_Project to G:\Test_Project).


    g) The View menu does not have a Bookmarks window. (Also, the View menu --> Other Windows does not have a Bookmarks window). After looking at all the menus, I did not find a Bookmarks window.

  • It will be very useful to add more information than line number (e.g. funciton name) to book mark.

Page 2 of 2 (18 items) 12
Leave a Comment
  • Please add 7 and 7 and type the answer here:
  • Post