Click here to Skip to main content
6,595,854 members and growing! (18,913 online)
Email Password   helpLost your password?
General Programming » Macros and Add-ins » VS.NET Add-ins     Intermediate

Regions Add-In for VS.NET 2003

By JWT

Create an add-in for VS.NET 2003 to create regions.
C#, VB, Windows, .NET 1.1VS.NET2003, Dev
Posted:7 Jun 2004
Updated:11 Feb 2005
Views:192,194
Bookmarked:125 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
52 votes for this article.
Popularity: 7.81 Rating: 4.55 out of 5
3 votes, 5.8%
1

2
3 votes, 5.8%
3
8 votes, 15.4%
4
38 votes, 73.1%
5

Sample Image

Introduction

I find I spend a lot more time than I would like adding newly created functions to existing regions or new regions. So for myself and anyone else like me, I have developed this add-in.

Using the code

Two new commands are added to the context menu in the code window, when there is code selected.

Add To New Region will create a new Region, using the text supplied from a dialog, around the selected code.

Add To Existing Region will show a dialog allowing you to select which region the code should be added to. You can also use this function to create a sub-region by ticking the checkbox.

V2.0

I have added a couple of new features.

The Region Explorer

This is a tool window that can be docked or floating, just like the Solutions Explorer and other VS tool windows.

  • Shows the position of regions in the opened document.
  • Can be used to 'jump' to a region that is not visible in the current document view.
  • Can be used to paste text from the clipboard to a region.
  • Can be used to add text to a region via drag'n'drop.

The Region Explorer is not available and will be empty, if the current active editor window is a Design View or any tool window type (e.g. Start Page, XML, etc...).

Use the Region Explorer command on the View menu to show, and the close button of the control to hide.

Setup Dialog

Also in v2 is a setup dialog to allow some flexibility in the way the add-in is configured. This setup can be accessed from the Tools menu or from the button on the Region Explorer.

Points of Interest

This version should work for C# and VB in VS.NET 2003.

It has not been tested under VS.NET 2002, but it will at least need the registry entries changing from:

 HKEY_LOCAL_MACHINE\
  SOFTWARE\
    Microsoft\
      VisualStudio\
        7.1\
          AddIns\
            RegionsAddIn.Connect

to probably:

HKEY_LOCAL_MACHINE\
  SOFTWARE\
    Microsoft\
      VisualStudio\
        7.0\
          AddIns\
            RegionsAddIn.Connect,

although this is only supposition on my part.

Important

If the v1.x version was previously installed, it should be removed using the following process, before installing v2.0.

  • Close VS.NET.
  • Uninstall v1.x from Add/Remove Programs.
  • Open VS.NET (you may get a message declaring that VS.NET cannot load the add-in; this is fine, we want VS.NET to remove all its references to this add-in).
  • Load a project, and select some code. Right click, select 'Add To New Region'. (You may get a message declaring that VS.NET cannot load the add-in; this is fine, we want VS.NET to remove all its references to this add-in.) Now do the same for the 'Add To Existing Region' command.
  • Close VS.NET.
  • Install v2 of the add-in, and continue as normal.

History

  • 08/06/2004 - First release.
  • 15/06/2004 - v1.1. Updated code to fix bugs identified by 0siris, and Alex Kucherenko. Also, added check to stop any region that is spanned by the selection from being displayed in dialog.
  • 06/02/2005 - v2.0. Major rewrite to fix reported bugs and to add new features.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

JWT


Member

Location: United Kingdom United Kingdom

Other popular Macros and Add-ins articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 130 (Total in Forum: 130) (Refresh)FirstPrevNext
GeneralPerformance problem - read this first before you download if you have a large file PinmemberRichard Hollis3:27 11 Mar '09  
AnswerNot visible under Vista - Semi-Solution PinmemberDaveyM699:18 10 Sep '08  
Generalcrash when opening property page (fix included) PinmemberRob Siklos4:54 26 Aug '08  
Generalposition of Region Explorer lost on VS restart PinmemberRob Siklos7:32 22 Aug '08  
GeneralUpgrade: Regions Add-In for VS.NET 2005 and VS.NET 2008 Pinmemberjanyou0:27 22 Apr '08  
GeneralRe: Upgrade: Regions Add-In for VS.NET 2005 and VS.NET 2008 Pinmemberpeervanrees1:08 20 May '08  
GeneralRe: Upgrade: Regions Add-In for VS.NET 2005 and VS.NET 2008 Pinmemberpetert14013:26 8 Jun '08  
GeneralRe: Upgrade: Regions Add-In for VS.NET 2005 and VS.NET 2008 Pinmemberjanyou0:29 18 Jun '08  
GeneralRe: Upgrade: Regions Add-In for VS.NET 2005 and VS.NET 2008 Pinmemberpetert14012:22 18 Jun '08  
GeneralRe: Upgrade: Regions Add-In for VS.NET 2005 and VS.NET 2008 Pinmemberjanyou18:23 20 Jun '08  
GeneralRe: Upgrade: Regions Add-In for VS.NET 2005 and VS.NET 2008 Pinmemberpetert140121:03 20 Jun '08  
GeneralRe: Upgrade: Regions Add-In for VS.NET 2005 and VS.NET 2008 Pinmemberfdsfatboy7:07 16 Jul '08  
GeneralRe: Upgrade: Regions Add-In for VS.NET 2005 and VS.NET 2008 Pinmemberjanyou20:41 4 Sep '08  
QuestionMicrosoft Visual Studio 2008 Updates? Pinmembermejax23:17 25 Nov '07  
GeneralRegionAddin PinmemberHSD79:36 15 May '07  
GeneralRe: RegionAddin PinmemberMLansdaal10:41 16 May '07  
GeneralRe: RegionAddin PinmemberHSD715:26 16 May '07  
GeneralREGIONS Pinmemberstixoffire13:36 15 Mar '07  
Generalinstall problem... Pinmembersmith56714:55 7 Dec '06  
GeneralRe: install problem... Pinmemberhahnl4:00 25 Jan '07  
GeneralBUG found! (and FIX) PinmemberSilbär23:44 11 Oct '06  
GeneralUse with VS2005 - Working (mostly!) PinmemberFinishedOnTime10:21 13 Apr '06  
GeneralRe: Use with VS2005 - Working (mostly!) PinmemberM.Lansdaal10:53 20 Apr '06  
GeneralRe: Use with VS2005 - Working (mostly!) PinmemberFinishedOnTime5:50 11 Jun '06  
QuestionRe: Use with VS2005 - Working (mostly!) PinmemberDalePres13:07 13 Nov '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 11 Feb 2005
Editor: Smitha Vijayan
Copyright 2004 by JWT
Everything else Copyright © CodeProject, 1999-2009
Web17 | Advertise on the Code Project