How to: Rename an Identifier (Visual Basic)

The Visual Studio Integrated Development Environment (IDE) can analyze your code and use scoping information to assist in renaming identifiers. This provides a more controlled renaming experience than using find and replace.

For example, consider a class that defines two subroutines named Test1 and Test2, each subroutine defining a variable named Value. If you rename the Value variable in Test1 to Counter, all code in Test1 that referenced Value will be updated to reference Counter.However, the code in Test2 will not be changed.

To rename from any instance of the identifier

  1. Right-click the identifier.

  2. Choose Rename from the shortcut menu to open the Rename dialog box.

  3. Change the name in the New Name box to the new name for the identifier.

  4. Click OK to rename all references to the identifier.

To rename from the identifier declaration

  1. Select the identifier name where it declared.

  2. Change the name of the identifier.

    When you change the name, a symbol appears under the right side of the name.

  3. Rest your mouse pointer over the symbol to activate the smart tag.

  4. Click the smart tag glyph to open the panel.

  5. Choose the Rename panel item to rename the other references to the identifier.

See Also

Reference

Refactoring and Rename Dialog Box (Visual Basic)

Other Resources

Using the Visual Basic Development Environment