Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
  Tip: Use code regions to simplify VB .NET code  
 
 

In VB .NET, you can use code regions to group related pieces of code. You can click the + or - sign to the left of a region's start to expand or collapse its code. This makes the code easier to read (you can hide things you are not interested in) and easier to manage (search functions only search code that is expanded so you can restrict your search to relevant code).

The syntax looks like this:

    #Region "Region Name"
        ... code ...
    #End Region

Make the region names descriptive. You can make the End Region statement a bit easier to understand by adding a comment as in:

    #Region "Color Selection Code"
        ... code ...
    #End Region ' Color Selection Code

 

Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated