Problem solve Get help with specific problems with your technologies, process and projects.

Navigating your code in Visual Studio 2010

Once you get a couple pages of code written for a project, you'll want to use the Visual Studio navigation features to move intelligently through your code. Read this tip to learn about Visual Studio features that make moving through your code a snap.

As soon has you have more than a couple pages of code in a project, you'll want to use the Visual Studio navigation features to move intelligently through your code. In this tip I'll show you some the Visual Studio features that make moving through your code a snap.

C# curly brace matching

Use Ctrl- ] (Square Bracket) to move between matching pairs of braces or parenthesis.

Go to Definition

If you've been using Visual Studio for any length of time you probably are familiar with this shortcut. Place your cursor on a variable, type name or other code item. Press F12 to navigate the definition of that item. You can also use the context menu. Simply right-click and choose "Go to Definition.

Navigating backward and forward

In the previous section I talked about using F12 navigate to the code definition. Visual Studio provides an easy way to return to your original code location. Click the View/Navigate Backward menu item or choose the Navigate Back tool buttons.

Find All References

It can be useful to find every place in a project where a method is called or some other symbol is used. You can find where a method or property is called by right-clicking its definition and selecting Find All References from the drop-down menu. This is also available by selecting the definition in your code and pressing Shift+F12. This feature searches the entire solution for any reference to a chosen item. Note that it finds true references. This better than using search as you might have several items declared with the same name in different areas or namespaces.

View Call Hierarchy

This fabulous new feature enables you to navigate through your C#/C++ code by displaying all calls to and from a selected type member. Unlike Find All References, the Call Hierarchy feature provides and more detailed information about calls. This enables you to better understand your code flow and to navigate to calling code.

Invoke the tool by right-clicking on a method or property name in the code editor and choosing View Call Hierarchy from the context menu.

The Call Hierarchy window is displayed, it's usually docked the lower edge of the screen.


Bookmarks are a way to add placeholders within your code. Basically you add a bookmark to a code line by pressing Ctrl-K,Ctrl-K or using the Bookmark toolbar.

Once you create a bookmark, Visual studio adds a symbol to the right margin of your code window.

Now you can move between the bookmarks. There are number ways of doing this. You can use the bookmark toolbar or bookmarks menu. There is also a bookmark window that shows you every bookmark in your project. You'll find it in the view menu.

A handy feature of the bookmark window is that you can rename each bookmark.

As you can see, there are many ways to navigate your code besides using the traditional up/down arrows and mouse scrollbars. Why don't you try a few of these new techniques on your next project?

Dig Deeper on Visual Basic and C# development skills

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.