Helixoft Blog

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

Converting "On Error..." To "Try...Catch"

We all know that we should use Try ... Catch instead of On Error... But our VSdocman contains some code ported from VB6. This code naturally uses On Error... and it was OK as long as the code worked correctly.

Recently, we decided to clean the old code and use String.equals method for comparing two strings instead of = operator. And suddenly On Error Resume Next wasn't good anymore. If the original method was

Adding a Strongly Typed Collection to a Project

There's not too much to explain about strongly typed collections. There are many articles describing how to implement them. However, there are not so many add-ins or macros that can generate them automatically for you. I needed these collections in my projects as well so I wrote a macro which asks you for item type, automatically creates class file, adds it to the current project and generates fully documented strongly typed collection. It generates VB code but it can be easily modified to create C# or other language as well.

For example we want a String collection. After invoking the macro we specify the type.

How To Customize Context Menu in VS .NET

You already know that you can customize main menu and toolbars and you can place commands or macros on them. Unfortunately you cannot customize context (shortcut, right-click) menu this way in VS .NET 2002 and 2003. You simply cannot invoke context menu in Customize mode. You can do it easily in VS 2005.

For VS 2002/2003 we must use small trick. We create exact copy of context menu in VS main menu, right after the Help menu. This "mirror" menu is fully customizable. After we make changes to this copy, we copy them back to the context menu.

In more detail:


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