Visual Basic Compiler Options  

/optionexplicit

Causes the compiler to report errors if variables are not declared prior to use.

/optionexplicit[+ | -]

Arguments

+ | -
Specify /optionexplicit+ to require explicit declaration of variables. /optionexplicit+, which is the same as /optionexplicit, is the default. /optionexplicit- allows implicit declaration of variables.

Example

The following code compiles when /optionexplicit- is used:

Module Module1
   Sub Main()
      i = 99
      System.Console.WriteLine(i)
   End Sub
End Module

See Also

Visual Basic Compiler Options | /optionstrict | Sample Compilation Command Lines | Option Explicit Statement