Using the Editor
The Visual Studio .NET environment includes a powerful text editor. This
editor includes a number of features aimed at making your code-writing
experience more productive and as flexible as possible. The following
subsections describe some of the Visual Studio .NET code editor features.
Using IntelliSense to Enter Code
Programming in Visual Studio .NET, even at the very beginning, involves
working with members (properties and methods) of objects. To make it easier
for you, when you enter the name of any object, Visual Studio .NET provides
a drop-down list of the members of that class of object. In addition, when
you type the name of a method, Visual Studio .NET provides a description of
the method signature, including a list of all the parameters you need to
supply for the method and a list of all the various ways you can call the
method. This technology is named IntelliSense. In addition, IntelliSense
allows you to auto-complete any syntax by pressing the space bar or the Tab
key once the command you wish to use is highlighted.
Splitting the Editing Window
At times, you may want to view locations within the same code window, as
shown in Figure 3.18. You can select the Window, Split menu item to insert
a horizontal splitter bar into the code window. You can scroll each pane of
the window individually, allowing you to view two locations within the same
file. You can also split the editing window by grabbing the divider bar in
the upper-right corner of the editing window and dragging it downward.
Double-clicking the same area acts as if you'd selected the Window, Split
menu item.
Figure 3.18. You can split the window to see two different areas of your
code at the same time.
TIP
If you need a full-height split of a document window, use the Window, New
Window menu item to create a second window. Then position it however you
like.
Finding Text
You can search for text anywhere in the current procedure, the current
module, or within a highlighted block of code. From any code window, you
can select the Edit, Find and Replace, Find menu item or press Ctrl+F to
bring up the Find dialog box, as shown in Figure 3.19. If you highlight a
piece of text in your code window and then select the Find window, the text
will be automatically added to the Find What combo box.
Figure 3.19. The Find dialog box will help you search for text in your
project.
Enter a piece of text in the Find What combo box and click the Find Next
command button to find the next location in the code that matches the
string. You can keep this dialog box open and keep clicking Find Next to
find the next occurrence of the string. You can also close the Find dialog
box and press F3 to repeat the search.
There are other options you can use to find a particular string in your
source code. You can narrow your search to the current procedure or the
current module, or you can search across all open documents. You can find a
whole word that matches the string you input, you can perform a
case-sensitive search, or you can enter wildcards, such as * and ?, to
perform pattern matching.
Replacing Text
Replace text using the Replace dialog box. To bring up the Replace dialog
box, select Edit, Find and Replace, Replace, press Ctrl+H from within a
code window, or click the Replace command button in the Find window. Figure
3.20 shows an example of the Replace dialog box.
Figure 3.20. Find and Replace can come in handy for changing one variable
name to another.
This dialog box is essentially the same as the Find dialog box, but it
allows you to replace one piece of text at a time. You can also find the
next occurrence of the Find What text by clicking Find Next. If you wish to
replace all the values within the scope specified, you can click Replace
All.
Finding Text in All Project Files
The Find dialog box is useful if you are searching open documents, but if
you need to search for items in any file in your current project or in your
whole solution, you will need to use the Find in Files dialog box shown in
Figure 3.21. This dialog box allows you to search all files, regardless of
whether they are open, across the current project, or even across the whole
solution.
Figure 3.21. Find in Files allows you to look for text in all files,
regardless of whether they are open.
Replacing Text in All Project Files
The Replace in Files dialog box, shown in Figure 3.22, allows you to
perform a search-and-replace operation throughout the files in your project
or within a folder. A nice feature of the Replace in Files