Flylib.com

Books Software

 
 
 

About the Code in This Book

 < Free Open Study > 


About the Code in This Book

Code in this book for the most part will be in Visual Basic; therefore, the sample code for this book will for the most part be in Visual Basic. The reason for this is obvious: Visual Basic continues to be the single most popular programming language. However, I avoid most Visual Basic-specific commands so that you will find it trivial to migrate the code in this book to C#. The methods and properties referenced in the sample code apply to VB .NET, C#, and other .NET languages.

Most of the code supplied for this book is in the form of add-in projects or solutions. They consist of whole solutions, including all of the files for all of the projects in the solution. Normally, there is a solution (.sln) with two projects. There is a project for the add-in and a setup project for the solution. The easiest way to run the add-in on your machine is to load the add-in solution into Visual Studio .NET. You then need to build and install the add-in. This causes the proper registry entries to be created.

Note 

The Add-in Wizard will normally create the proper registry entries when an add-in is created initially.When an add-in is moved to another computer, as will be the case for the code for this book, the registry entries will not automatically be in the registry of the destination computer. This is true even when you try to start the add-in in debug mode.

In order for the add-in to run, it must be registered and the Add-in Manager must be able to see it. Building and installing the add-in will create the required registry entries for you. For information on how to build and install an add-in, please see the "Installing the New Add-in" section in Chapter 2. This subject is covered again in Chapter 13. In that chapter you will see a procedure for manually registering and creating the Add-in Manager registry entries.

You can download the code from this book from the Downloads section of the Apress Web site (http://www.apress.com). I trust that you will download the code from there, rather than typing it in from the book. There are two reasons for this. First, typing it in is a time-consuming and error-prone process. Second, there is a lot of code involved in one add-in, and there is at least one add-in in each of the chapters from Chapter 2 through Chapter 12.



 < Free Open Study > 
 < Free Open Study > 


Chapter 1: What Is an Add-in?

Overview

"Your footsteps are easier to follow than your advice".

-- Author Unknown

An add-in is a tool that you create programmatically by using objects, methods, properties, collections, and events in .NET's extensibility object model. These objects and their respective methods , properties, and events enable you to automate difficult and tedious tasks within the Visual Studio integrated development environment (IDE). These tasks are usually accomplished in response to an event, such as the mouse being clicked, a form being added to a project, or a control being added to a form. The action may or may not be visible to the developer.

I'm not sure why Microsoft calls this functionality "add-in" instead of "add-on" or "extender". However, it is interesting to note that if you take the letters a and i from "add-in", it could be an abbreviation for artificial intelligence (AI). Without being presumptuous, certain add-in features act like AI. For example, consider the form prompter dialog box, which pops up when you add a form to a project. The dialog box asks you for certain required properties, such as form name , text (caption in earlier versions of Visual Basic), and other properties, such as sizing options and whether the form should stay on top (TopMost) of other forms. The add-in has jumped ahead of the developer and reminded him to fill in certain required information, without his having to bring up or search through the property window. It also keeps him from having forms named Form1, Form2, and so forth.

As is the case with ActiveX components , several third-party software vendors write complex add-ins for Visual Studio. I have developed and marketed commercially three major add-ins: VBCommander, VBXRef, and VBCommander/Pro.



 < Free Open Study >