#Region Directive

Collapses and hides sections of code in Visual Basic files.

Syntax

      #Region "identifier_string"  
#End Region  

Parts

Term Definition
identifier_string 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.

Remarks

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. You can place, or nest, regions within other regions to group similar regions together.

Example

This example uses the #Region directive.

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

See Also

#If...Then...#Else Directives
Outlining
How to: Collapse and Hide Sections of Code