/define (Visual Basic)
Defines conditional compiler constants.
Required. The symbol to define.
Optional. The value to assign
symbol. If value is a string, it must be surrounded by backslash/quotation-mark sequences (\") instead of quotation marks. If no value is specified, then it is taken to be True.
option has an effect similar to using a /define preprocessor directive in your source file, except that constants defined with #Const are public and apply to all files in the project. /define
You can use symbols created by this option with the
... #If ... Then directive to compile source files conditionally. #Else
is the short form of /d
You can define multiple symbols with
by using a comma to separate symbol definitions. /define
To set /define in the Visual Studio integrated development environment
Have a project selected in
Solution Explorer. On the Project menu, click Properties. For more information, see . Introduction to the Project Designer
Modify the value in the
Custom Constants box.
The following code defines and then uses two conditional compiler constants.
' Vbc /define:DEBUGMODE=True,TRAPERRORS=False test.vb
#If debugmode Then
' Insert debug statements here.
MsgBox( "debug mode")
' Insert default statements here.
( 1500 characters remaining)
Thank you for your feedback