Partilhar via


Setting Bookmarks in Code

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

You can use bookmarks to mark lines in your code so that you can quickly return to a specific location and jump back and forth between locations.

Bookmark commands and icons are available in two places: the bookmark window (View/Bookmark Window) and the text editor toolbar.

Managing Bookmarks

To add a bookmark, place the cursor on the line you want to bookmark. Click the Toggle button, or press CTRL+K. This adds the bookmark. If you click the Toggle button (or press CTRL+K) again, the bookmark is removed. You can also delete bookmarks by clicking the Delete button in the bookmark window.

Important

The bookmark is set to the line number, not to the code. If you modify the code, the bookmark is retained at the line number, and does not move with the code.

You can navigate between bookmarks by using the Next Bookmark and Previous Bookmark buttons in the bookmark window.

You can organize bookmarks into virtual folders by clicking New Folder in the bookmark window and then dragging selected bookmarks into the new folder.

You can turn off bookmarks (without removing them) by clicking the Disable All Bookmarks button in the bookmark window. You can re-enable them by clicking the same button (which is now called Enable All Bookmarks).