Directives (Visual Basic)

The topics in this section document the Visual Basic source code compiler directives.

In This Section

#Const Directive -- Define a compiler constant

#ExternalSource Directive -- Indicate a mapping between source lines and text external to the source

#If...Then...#Else Directives -- Compile selected blocks of code

#Region Directive -- Collapse and hide sections of code in the Visual Studio editor

#Disable, #Enable -- Disable and enable specific warnings for regions of code.

#Disable Warning BC42356 ' suppress warning about no awaits in this method  
    Async Function TestAsync() As Task  
    End Function  
#Enable Warning BC42356  

You can disable and enable a comma-separated list of warning codes too.

Visual Basic Language Reference

Visual Basic