Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
There are various ways to move through text or code in the Code Editor using 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.
Use the Navigate Backward button to move the insertion point to previous locations in the active document, and the Navigate Forward button to return to more recent locations.
Operations such as Incremental Search, Goto Line, Goto Definition, Beginning of Document, End of Document, Paste, and Insert File can move the insertion point a significant distance within the active document. The Navigate Backward and Navigate Forward buttons retain the last 20 locations of the insertion point.
The following sections describe other ways to move to specific sections and lines of code:
Navigation bar
Bookmarks in the Bookmarks Window
Comment tasks in the Task List
Incremental searches
Go to Line command
Go to Definition command
Navigating with the Navigation bar
The Navigation bar consists of two combo boxes displayed at the top of the Code Editor. It allows you to navigate directly to a particular class or type, or to a procedure or member within it. Not every project incorporates the Navigation bar. The following descriptions show you how to use navigate through your code.
Note
The names of the two combo boxes on the Navigation bar vary depending on the type of project. For example, in Visual Basic projects, the boxes are named Class Name and Method Name. In C# projects, the boxes are named Types and Members.
To shift focus from the Code Editor to the Navigation bar
- Press the shortcut key combination CTRL+F2.
To return focus from the Navigation bar to the Code Editor
- Press the ESC key.
To shift focus from item to item on the Navigation bar
- Press the TAB key.
To select the Navigation bar item that has focus and return to the IDE
- Press the ENTER key.
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
Bookmarks help you navigate to sections of code more quickly. The following examples show you how to use Visual J# Express Edition bookmarks.
To add a bookmark
In the editor, select a line you want to return to at a later time.
On the Bookmarks toolbar, click the Toggle a bookmark on the current line button.
.gif)
-or-
Press CTRL+K.
A bookmark symbol is displayed in the left margin of the Code Editor to mark the line.
.gif)
Keep pressing CTRL+K to toggle a bookmark on and off.
To move through bookmarks in the active document
On the Bookmarks toolbar, click Move the caret to the next bookmark. to scroll to the next bookmark in your code.
-or-
Press CTRL+K and then CTRL+N to move to the next bookmark.
.gif)
On the Bookmarks toolbar, click Move the caret to the previous bookmark. to scroll to the preceding bookmark in your code.
-or-
Press CTRL+K, and then CTRL+P to move to the previous bookmark.
.gif)
Another way to return to a location is by using the Navigate Backward and Navigate Forward buttons.
To remove all bookmarks from a document
In the Bookmarks window, click the Clear Bookmarks button.
—or—
Press CTRL+K, and then CTRL+L to erase all bookmarks from the active document.
.gif)
Note
To delete a single bookmark, right-click the bookmark, and click Toggle Bookmark, or keep pressing CTRL+K until the bookmark is removed.
Navigating with Comment Tasks
A comment task begins with the phrase //TODO and reminds you of code that requires completion. You can create comments tasks in your code that mark places to which you will need to return, and then navigate directly to those locations from the Task List.
To create and use a comment task
In the View drop-down list, point to Other Windows, and then click Task List.
The Task List grid displays a list of work items as well as their statuses.
On the Comment drop-down list, click Comments.
All comment tasks in the code of the active document display.
Add a comment task to your code, type two forward slashes followed by a space and then the keyword TODO. For example: // TODO Finish this code!
As soon as you type TODO, this task is automatically added to the Comments list in the Task List. As you change the text, the Comments list automatically updates.
Click any comment task to navigate to its location in your code.
For more information, see Task List (Visual Studio).
Incremental Search
Incremental search helps you navigate directly to locations in the current document as you enter the search characters. The following instructions show you how to perform an incremental search.
To navigate using incremental search
On the Edit menu, click Advanced, and then click Incremental Search.
Begin typing the characters of the string you wish to find.
As you add characters, the Code Editor highlights the first matches found in the current document.
Go to Line command
The following instructions show you how to use the Go to Line command to move the insertion point to a specific line number.
To go to a specific line number
In the General, All Languages, Text Editor, Options Dialog Box, select the Line Numbers option.
With a document open in the editor, select Go to Line from the Edit menu.
Enter the line number you want to view.
Go to Definition command
The Go to Definition command navigates to the procedure for a local class declaration, method, or a variable definition. For example, if you define a procedure called MyProc(), and then later in your code make a call to MyProc(), you can navigate directly to the procedure for this method using Go to Definition.
The following instructions show you how to find your local class declarations, methods, or variable definitions using the Go to Definition command.
To go to the definition for the procedure or variable called
Select any call to a procedure or variable.
Press F12.
The Code Editor displays the procedure or variable.
To return to the point of the call, press the Navigate Backward button.
If the definition lies outside your project, its source displays in the Object Browser. For more information, see Using the Object Browser.