The Documents Collection

 < Free Open Study > 


"What matters most in life is not so much how much time we have, but what we do with the time we are given".

--Author Unknown

Thus far in working with code in the IDE's Text Editor windows, I've made very few references to the extensibility object of Visual Studio .NET. I've done this for two reasons. First, I wanted to get quickly and simply into building some usable functionality in an add-in. Second, I wanted to demonstrate the use of some common methods that you can reuse most of the time for retrieving code from a code window, performing some operation on the code, and subsequently putting it back into the code window without having to constantly be concerned with the complex syntax of the extensibility object. I suspect that the library routines I've provided for retrieval and replacement of code in a window will work for you 90 percent of the time you want to work on code.

In this chapter, I concentrate on the text-handling objects in the extensibility model. There will obviously be times when you will need to do something to or with code windows that goes beyond simply retrieving and putting back code. Therefore, you must explore some of the extensive details of the text-handling objects. In this chapter, I introduce you to the Documents collection and the Document object as a lead-in to learning how to control the Visual Studio .NET Code Editor.


I don't want to jump ahead into the subject of macros (which is reserved for Chapter 8). However, if you're already familiar with the use of macros in Visual Studio .NET, you can take the code from the short example snippets in the next few topics, enclose it with Sub/End Sub, and actually execute these examples in the Macros IDE. Because I'm illustrating code snippets in the context of an add-in, if you choose to execute the code in the Macro Explorer, substitute DTE for oVB wherever you find it in the code samples.

 < Free Open Study > 

Writing Add-Ins for Visual Studio  .NET
Writing Add-Ins for Visual Studio .NET
ISBN: 1590590260
EAN: 2147483647
Year: 2002
Pages: 172
Authors: Les Smith © 2008-2017.
If you may any questions please contact us: