Datasheet
60
❘
CHAPTER 1 VISUAL STUDIO 2010
The code that appears in step 9 may vary depending on how you typed in the line. For example, if you made
a mistake and backspaced, those actions will have their own corresponding lines of code. As a result, after
you record a macro, it is worthwhile to examine the code and remove any unnecessary lines.
The code in a macro recorded this way is just standard VB code, and it can be modifi ed as desired.
However, there are some restrictions regarding what you can do inside the macro IDE. For example,
you cannot refer to the namespace for setting up database connections, because this might constitute a
security violation.
To run a macro, you can just double - click it in the Macro Explorer or select Tools
➪ Macros ➪ Run Macro. You
can also assign a keystroke to a macro in the Keyboard dialog in the Tools ➪ Options ➪ Environment folder.
One fi nal note on macros is that they essentially enable you to generate code that can then be transferred to
a Visual Studio Add - In project. An Add - In project is a project designed to extend the properties of Visual
Studio. To create a new Add - In project, open the New Project dialog and select Other Project Types —
Extensibility. You can then create a Visual Studio Add - In project. Such a project enables you to essentially
share your macro as a new feature of Visual Studio. For example, if Visual Studio 2010 didn ’ t provide a
standard way to get formatted comments, you might create an add - in that enables you to automatically
generate your comment template so you wouldn ’ t need to retype it repeatedly.
Class Diagrams
One of the features introduced with Visual Studio 2005 was the capability to generate class diagrams. A
class diagram is a graphical representation of your application ’ s objects. By right - clicking on your project
in the Solution Explorer, you can select View Class Diagram from the context menu. Alternatively, you can
choose to Add a New Item to your project. In the same window where you can add a new class, you have
the option to add a new class diagram. The class diagram uses a .cd fi le extension for its source fi les. It is a
graphical display, as shown in Figure 1 - 42.
FIGURE 1 - 42
CH001.indd 60CH001.indd 60 4/5/10 11:57:05 AM4/5/10 11:57:05 AM