Name

Option Explicit Statement

Synopsis



Option Explicit [On | Off]

Description

Use Option Explicit to generate a compile-time error whenever a variable that has not been declared is encountered.

In modules where the Option Explicit statement is not used, any undeclared variables are automatically cast as Objects.

The default is Option Explicit On. In other words, the statement:

Option Explicit

is equivalent to:

Option Explicit On

Get VB.NET Language Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.