#Region Directive
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

#Region Directive 

Collapses and hides sections of code in Visual Basic files.

#Region "identifier_string"
#End Region


Required. String that acts as the title of a region when it is collapsed. Regions are collapsed by default.

#End Region

Terminates the #Region block.

Use the #Region directive to specify a block of code to expand or collapse when using the outlining feature of the Visual Studio Code Editor. #Region statements support block semantics (such as #If...#End If), meaning that the start and end must be in the same code block.

This example uses the #Region directive.

#Region "MathFunctions"
    ' Insert code for the Math functions here.
#End Region

© 2016 Microsoft