O'Reilly logo

Visual Basic 2012 Programmer's Reference by Rod Stephens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

ARCHITECTURAL TOOLS

The code editor provides several powerful tools that can help you understand the structure of your code and how to navigate through its pieces. They can give you a better understanding of how the pieces of the program fit together, and they can help you track down important code snippets, such as where a variable or type is defined and where one piece of code is called by others.

The following sections describe the most useful of these kinds of architectural tools and explain how to invoke them.

Rename

If you right-click the definition or occurrence of a symbol, such as a variable, subroutine, function, or class, and select Rename, Visual Studio displays a dialog box where you can enter a new name for the item. If you enter a name and click OK, Visual Studio updates all references to that symbol. If the symbol is a variable, it changes all references to the variable so they use the new name.

This is much safer than using a simple textual find-and-replace, which can wreak havoc with strings that contain your target string. For example, if you textually replace the variable name factor with issue, your Factorial function becomes Issueial. In contrast, if you right-click the factor variable, select Rename, and set the new name to issue, Visual Studio only updates references to the variable.

CORRUPTED COMMENTS
Unfortunately, Rename still leaves any comments that discuss the factor variable unchanged. You’ll have to search the comments to fix them.

Go To ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required