title | description | ms.date | f1_keywords | helpviewer_keywords | ||||||
---|---|---|---|---|---|---|---|---|---|---|
#Region directive |
Learn how to group related lines of code using region directives in Visual Basic. |
05/14/2021 |
|
|
Collapses and hides sections of code in Visual Basic files.
#Region string_literal
' 0 or more statements
#End Region
Term | Definition |
---|---|
#Region |
Required. Specify the start of a region. |
string_literal |
Required. String (enclosed between double quotes) that acts as the title of a region when it is collapsed. Regions are collapsed by default. |
#End Region |
Required. Terminates the #Region block. |
Use the #Region
directive to specify a block of code to expand or collapse when using the outlining feature of Visual Studio IDE. You can place, or nest, regions within other regions to group similar regions together.
This example uses the #Region
directive.
[!code-vbVbVbalrConditionalComp#4]