Helixoft Blog

Peter Macej - lead developer of VSdocman - talks about Visual Studio tips and automation

Macro for Adding New Property

Visual Studio 2002 and 2003 contains many sophisticated tools but it misses one of the most important - new procedure/property builder. MZ Tools add-in makes a great job here.

If you only need to create new property, I'll show you a simple macro which will help you. It will ask you for property name and type and then it will place property definition at current cursor position.

Button for Inserting Property

How To Import/Export VS .NET 2002/2003 Settings

Unlike VS 2005, there is no Import/Export Settings function in VS .NET 2002 and 2003. This is really useful if you want to backup your IDE settings (fonts&colors, toolbars, external tools, editor settings etc.) for the case you'll need to reinstall Visual Studio. Or you might want to share IDE settings among all users.

There is a way for VS .NET 2002 and 2003 too. All important settings are stored in the registry. So all you need to do is save them to the .REG file and then load them. Run regedit and navigate to proper key. Then select Export from right-click menu to store the data into .REG file. You need to repeat this action for each key you want to save. Then when you want to restore the data, just double-click each .REG file. Or import it in regedit from File - Import... menu.

Interesting registry keys for VS .NET 2002:

VS Macro for Pasting Long Text as String

Did you ever want to write very long string constant in your source code? You surely did if you wanted to display longer text in message box, for example. Or you wanted to create a macro which generates some longer source code. In this case you needed the code template stored in a string if you didn't want to read it from a file.

Then you know it is not the easiest thing. You cannot simply paste the text into source code. What if the string text contains 1000 words and newlines? I will discuss a macro which generates VB version of long string here. But hey, non-VB people, don't go away! You already know that VB is a language of VS macros so it can be useful to you too. And you can easily modify the macro to produce string in other languages.

Let's say we want a string with the following text:

Changing Documents Tabs Order in VS 2005

VS 2005 introduced new feature which confuses many people. Newly opened documents are placed in reverse order - to the left of already opened pages and not to the right as it used to be in VS 2002/2003 and as we know it from majority of programs that use tabbed interface. Existing documents are scrolled to the right. See MS Suggestion Page to see what I'm talking about.

Some people love this new feature while some hate it. MS has its arguments for this new design, see for example this forum. There are however reasons for traditional way too. For example, our VSdocman's Comment Editor can be placed as tabbed document.

Comment editor as tabbed document

Sharing a Source File Across Multiple Projects

"How can I share one source code file across several projects? I want to have this file on one place only and use it in multiple projects so when I modify it in one project, the changes get automatically reflected in all projects. When I add existing file to the project, a local copy is always created and used." This is the question that I answered many many times on various newsgroups. The answer is very simple:

  1. Go to menu Project - Add Existing Item...
  2. Select desired file and from drop-down menu on Open button (little triangle on the right side) select Link File.

    Link Shared File to VS project

    In VS 2005 this button is called Add and it has Add As Link option.

    Add shared file in VS 2005

This will only link existing file and will not create any local copy. It seems that Microsoft should change the way how to do it because so many VS users have this problem.

 

Start generating your .NET documentation now!
DOWNLOAD
Free, fully functional trial