Export (0) Print
Expand All
3 out of 6 rated this helpful - Rate this topic

Navigating Code and Text

There are several ways to move throughout text:

  • Mouse and navigation keys
  • The Navigation bar.
  • Bookmarks
  • Incremental search
  • Comment tasks in the Task List
  • The Go To Line command
  • The Go To Definition command
  • The Navigate Backward and Navigate Forward buttons

Navigating with the mouse and keys

The most common way to navigate text is with the mouse and navigation keys:

  • Use the arrow keys to move one character at a time, or the arrow keys in combination with the CTRL key to move one word at a time. Arrow keys move one line at a time also.
  • Click a location with the mouse.
  • Use the scroll bars or scroll wheel on the mouse to move through the text.
  • Use the HOME, END, PAGEUP, and PAGEDOWN keys.
  • Use CTRL+PAGE UP and CTRL+PAGE DOWN to move the insertion point to the top or bottom of the window, respectively.
  • Use CTRL+UP ARROW and CTRL+DOWN ARROW to scroll the view without moving the insertion point.

Navigating with the Navigation bar

The Navigation bar consists of two combo boxes that display at the top of the Code Editor and allow you to navigate directly to a particular class/type or procedure/member within it. Not every project incorporates the Navigation bar.

Note   The names of the combo boxes on the Navigation bar vary depending on the type of project. For example, in Visual Basic .NET projects, the boxes are named Class Name and Method Name. In C#.NET projects, the boxes are named Types and Members.

To navigate to a class or type

  • Click its name in the Class Name/Types combo box in the upper left corner of the document.

To navigate directly to a procedure in a class

  • Click a procedure in the Method Name/Members combo box in the upper right corner of the document.

Navigating with Bookmarks

To edit a document elsewhere and then return to your current location, add a bookmark.

To add a temporary bookmark

  1. Click the line you want to return to at later time.
  2. Click the Toggle Bookmark button . You should see the temporary (or "unnamed") bookmark symbol appear next to the line.
  3. Alternatively, you can press CTRL+K twice to toggle the bookmark.

To return to a temporary bookmark

  1. Click the Next Bookmark or Previous Bookmark button.
  2. Alternatively, you can press CTRL+K and then CTRL+N for the next bookmark, or CTRL+K and then CTRL+P for the previous bookmark within in a document.
    Tip   Another way to return to a location is by using the Navigate Backward and Navigate Forward buttons.

To remove one or more temporary bookmarks in a document

  • Click the Clear Bookmarks button .

    —or—

  • Press CTRL+K and then CTRL+L to erase all bookmarks in the current document.
    Note   To delete a single bookmark, right-click the bookmark and click ToggleBookmark, or press CTRL+K and then CTRL+K again.

To add a Task List shortcut (or "Named Bookmark")

  1. Right-click the line.

    Its name is added as a task in the Task List. You can edit the description in the Task List to change the name of the shortcut. This does not edit the line of code.

  2. To return to the line, double-click the task item in the Task List.

For more information, see Adding Comment Tasks to the Task List.

Navigating with comment tasks

You can create comments tasks in your code and navigate back to them later in the Task List.

To navigate to a comment task

  1. Create a comment task by entering a comment symbol for the language, such as an apostrophe (') character for Visual Basic and then a comment token, such as TODO:. This adds a comment task to the Task List.
  2. Move to another location in the document.
  3. Click the comment task to go to its location in your code.

Incremental Search

Incremental search helps you navigate directly to locations in the current document as you enter the search characters.

To navigate using incremental search

  1. Press CTRL + I or choose Incremental Search on the Advanced sub-menu on the Edit menu.
  2. Begin typing the characters of the word you wish to find. As you type the characters, you are taken to matching text in the current document, beginning at the top.

Goto Line command

Use the Goto Line command to go to a specific line number.

To go to a specific line number

  1. In the General, All Languages, Text Editor, Options dialog box, click Line Numbers.
  2. Click Goto Line in the Edit menu.
  3. Enter the line number you want to view.

Navigating to code elements using Go To Definition

Use the command Go To Definition to immediately navigate to the parent procedure for a method call or variable definition. For example, if you have a procedure called MyProc() and later make a call to MyProc(), you could navigate directly to the procedure using Go To Definition.

To go to a procedure or variable definition

  1. Select the variable or procedure call.
  2. Press F12.

You are taken to the procedure or variable definition. If you want to return to the variable or procedure call, press the Navigate Backward button.

If the definition lies outside your project, the item displays in the Object Browser.

Navigate Backward / Navigate Forward buttons

Use the Navigate Backward button to navigate to previously visited locations in the document, then use the Navigate Forward button to return afterwards. (You can also press CTRL + - to navigate backward and CTRL + SHIFT + - to navigate forward.) These buttons are particularly useful when using commands that take you far away from where you are currently working and you want to return to that location quickly. Examples of such commands are Incremental Search, Goto Line, Beginning of Document, End of Document, Pasting text or inserting file contents, and Go To Definition commands. The editor remembers locations when you move in a single command more than several lines away from where you are currently working, or if you edit in a particular location that is not adjacent to the last place you edited. The goal is to remember interesting locations so that you can recall where you have been working without remembering so many locations the feature is not useful (such as every character typed, or every line entering several new lines of code one right after the other).

See Also

Editing Code, HTML, and Text | Changing and Selecting Text | Dragging and Dropping Text

Show:
© 2014 Microsoft. All rights reserved.