Rename All Instances of Any Program Element
Symbolic rename allows you to rename all instances of any element you
declare in your program, from classes and interfaces to properties and
methods, in a single step. This technique, which is decidedly not a
simple text search-and-replace feature by virtue of its awareness of
program syntax, solves many knotty problems found in previous releases
of Visual Basic. For example, imagine you want to rename a public
property named FirstName. If you use
search-and-replace, you'll also inadvertently affect a text box named
txtFirstName, an event handler named
cmdFirstName_Click, a database field
accessed through row("FirstName"),
and even your code comments. With symbolic rename, the IDE takes care of
renaming just what you want, and it completes all of its work in a
single step.
Note
Need to rename a method, property, or variable without mangling other similar names in the same file? Visual Studio 2005 includes the perfect antidote to clumsy search-and-replace.
How do I do that?
You can use symbolic rename from any code window. To understand
how it works, create a form that has a single text box named TextBox1 and a button named cmdText. Finally, add the form code in Example 1-2.
Example 1-2. A simple form that uses the word "Text" heavily
Public Class TextTest Private Sub TextTest_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load ' Get the text from the text box. Dim Text As String = TextBox1.Text ' Convert ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access